Using routes in ASP.NET Gridview Hyperlinks

Total Post:154

Points:1086
 1082  View(s)
Ratings:
Rate this:

I have a Gridview with a Hyperlink column. I want to route(Navigate) using hyperlinks depending on the id value from the database.

<asp:HyperLinkField DataNavigateUrlFields="id" 
                      DataNavigateUrlFormatString="product"DataTextField="pName"
                      HeaderText="Product Name"       NavigateUrl='<%$ RouteUrl:id=Eval("id"), routename = ProductRoute%>'
       />

This results in an error message:

404 page not found

How can this be fixed?

  1. Post:378

    Points:2694
    Re: Using routes in ASP.NET Gridview Hyperlinks

    Hi manoj, 


    Try creating the link in the RowDataBound event handler in your code-behind and debug it there.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!