Dynamically set Hyperlink NavigateUrl property within a Gridview

I wanted to set my NavigateUrl Property to go to a different page and pass a querystring variable called ID that was retrieved from the database.  This is the solution

<asp:HyperLink ID=”LinkStory” runat=”server” NavigateUrl=’<%# Eval(“StoryID”, “StoryBook.aspx?mode=3&ID={0}”) %>

Text=’<%# Eval(“Title”) %> Width=”218px”></asp:HyperLink>

I found this on the codenewsgroups forum. here is the link:

http://www.codenewsgroups.net/group/microsoft.public.dotnet.framework.aspnet.webcontrols/topic9795.aspx

This entry was posted in Controls and tagged , , , , , . Bookmark the permalink.

5 Responses to Dynamically set Hyperlink NavigateUrl property within a Gridview

  1. Mapper99 says:

    This looks great, except, I need to add another paramater to the URL based on the value of a variable. Any idea how to do so?

  2. gargi says:

    it’s really very good & helpful.
    thnks

  3. jose d says:

    excelente justamente lo que estaba buscando

    gracias

  4. Click says:

    Click
    If a new article becomes available or if perhaps any changes occur on the current publication, I would be interested in reading a lot more and finding out how to make good usage of those approaches you discuss. Click

Leave a comment