문제

I have a HyperLink along with other controls such as Label etc in a GridView. The Label's in the GridView are dynamically populated like this:

<asp:Label ID="Label1" runat="server" Text='<%# Bind("ClientName") %>'></asp:Label>

I am now trying to do something similar with HyperLink, as in:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='http://www.company.com?clientname=<%# Bind("ClientName") %>'>Client Name</asp:HyperLink>

This doesn't give me any errors, but the link becomes this:

http://www.company.com/?clientname=<%# Bind("ClientName") %>

instead of something like this:

http://www.company.com/?clientname=oshiro

Anyone know how to get the link to work properly instead of just outputing the asp.net code?

도움이 되었습니까?

해결책

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ClientName", "http://www.company.com/?id={0}") %>'>Client Name</asp:HyperLink>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top