NavigateURL string format

2.4k views Asked by At

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.

1

There are 1 answers

0
King Jk On BEST ANSWER

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>