Reputation: 3896
What is the correct syntax to add a Eval() function to the NavigateURL attribute of asp:HyperLink?
I am trying to achieve the below:
NavigateUrl="http://home/?<%# Eval("U_ID") %>"
The link should be "http://home? + the value of U_ID" But the syntax isn't right I know. Whats the correct spelling?
Upvotes: 1
Views: 11774
Reputation: 205
It wasn't works my site. I found the following solution:
NavigateUrl='<%# string.Format("~/Home.aspx?{0}", HttpUtility.UrlEncode(Eval("U_ID").ToString())) %>'
Upvotes: 0
Reputation: 68400
Try with this
NavigateUrl='http://home/?<%# Eval("U_ID") %>'
or
NavigateUrl='<%# "http://home/?" + (string)Eval("U_ID") %>'
Upvotes: 7