How to pass a parameter to HyperLink in GridView/DataList

How to pass a parameter to HyperLink in GridView/DataList

 

The elegant code is just as follows.

<asp:HyperLink runat="server" NavigateUrl='<%# Eval("ID", "~/theurl.aspx?id={0}") %>' Text='<%# Eval("Title") %>'/>

 

or you could do the concatination like this:

property='<%# 'foo' + Eval("value")%>'

 

But DONOT do this:

property='foo<%#Eval("value")'


Source Link:
ASP.NET ItemTemplates, EVAL() and embedding dynamic values into controls
http://west-wind.com/weblog/posts/5364.aspx

你可能感兴趣的:(parameter)