[英]Passing through value in href
How do I pass a value through href tag in the XAML of my ASP.NET work? 如何在ASP.NET工作的XAML中通过href标记传递值?
I have tried this: 我已经试过了:
<a href='profile.aspx?ID=<%#HttpContext.Current.Session["id"]%>'>Profile</a>
However the URL displays like "profile.aspx?ID="
但是,URL显示为"profile.aspx?ID="
What am I doing wrong? 我究竟做错了什么?
For your code nugget to work properly with #
, you need to call the DataBind
method. 为了使您的代码块可以与#
一起正常使用,您需要调用DataBind
方法。 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.