Home > DeveloperSection > Forums > Using routes in ASP.NET Gridview Hyperlinks
Manoj Bhatt
Manoj Bhatt

Total Post:154

Posted on    August-23-2014 7:35 AM

 ASP.Net ASP.Net 

 1 Reply(s)
 782  View(s)
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?

Sumit Kesarwani

Total Post:378

Posted on    August-23-2014 8:48 AM

Hi manoj, 

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

Don't want to miss updates? Please click the below button!

Follow MindStick