Bunch's Blog

  Home  |   Contact  |   Syndication    |   Login
  48 Posts | 0 Stories | 36 Comments | 0 Trackbacks

News

Tag Cloud


Archives

Green

Here is how you can add a database value to the URL of a HyperLink that is in a GridView. In this example the text displayed is the same as the value added to the URL. Also the data is bound through a SqlDataSource and the “ID” value is from the output of the Select statement the SqlDataSource uses. This is a quick way to put the data in the URL without using any code in the code behind.

<asp:TemplateField HeaderText="ID" >

   <ItemTemplate>

<asp:HyperLink ID="hlID" runat="server" Text='<%# EVAL("ID") %>'                NavigateUrl='<%#"Default.aspx?ID=" + EVAL("ID") %>'/>

   </ItemTemplate>

</asp:TemplateField>

Technorati Tags: ,
posted on Wednesday, July 30, 2008 2:45 PM

Feedback

# re: NavigateUrl and EVAL 11/5/2008 6:28 AM sudhir
i was looking everywhere for an example that WORKS

thanks!!!

# re: NavigateUrl and EVAL 1/28/2009 9:56 AM Billy
Thank you!
This issue has taken me all day.
The cheque is in the post ;)

# re: NavigateUrl and EVAL 2/10/2009 10:41 AM Brownie
Awesome! Thanks.

# re: NavigateUrl and EVAL 3/22/2009 10:36 PM aspci
Thankyou so much

# re: NavigateUrl and EVAL 8/17/2009 11:13 PM .net Training and Classes
This code is really helpful to me...
Thanks

Dotnet Training
Dotnet Classes


Contact Us at
www.sharmawebacademy.com
Mail Us at
harish.solanki@sharmainfoway.com



Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: