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

posted @ 2006-05-18 11:46  Rickie  阅读(939)  评论(0编辑  收藏  举报