简体   繁体   中英

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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM