c0mrade
c0mrade

Reputation: 87

Passing through value in href

How do I pass a value through href tag in the XAML of my ASP.NET work?
I have tried this:

 <a href='profile.aspx?ID=<%#HttpContext.Current.Session["id"]%>'>Profile</a>

However the URL displays like "profile.aspx?ID="

What am I doing wrong?

Upvotes: 0

Views: 2603

Answers (1)

Rahul Singh
Rahul Singh

Reputation: 21795

For your code nugget to work properly with #, you need to call the DataBind method. Alternatively, you can use the code nugget with = and it should work fine for you:-

 <a href='profile.aspx?ID=<%= HttpContext.Current.Session["id"]%>'>Profile</a>

Upvotes: 2

Related Questions