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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2021-07-24
  • 2021-10-23
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-20
  • 2021-08-08
  • 2021-09-27
  • 2021-07-21
  • 2022-12-23
  • 2022-01-04
  • 2021-07-13
相关资源
相似解决方案