Question

I have looked to all the similar questions but is still not able to get it to work:

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# String.Format("~/Phones/DisplayPhoneDetails.aspx?SelectedPhoneMacAddr={0}", selectedCCMUserDetailled.primaryDevice.Value.ToString())%>'><%= selectedCCMUserDetailled.primaryDevice.Value %></asp:HyperLink>

This generates:

<a id="MainContent_HyperLink2">CSFD4SIG</a>

Thanks for your help.

Was it helpful?

Solution

you can't use <%%> in < asp: tag attribute

you can try use html tag like < a >

and to do this .below is my example

<a href=<%# String.Format("'~/Phones/DisplayPhoneDetails.aspx?SelectedPhoneMacAddr={0}'", selectedCCMUserDetailled.primaryDevice.Value.ToString())%>><%= selectedCCMUserDetailled.primaryDevice.Value %></a>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top