Reputation: 87
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
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