Home > DeveloperSection > Forums > Redirect to specific page when a gridview buttonfield is clicked
Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    September-05-2014 12:27 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 1054  View(s)
Rate this:

I have two fields in my gridview. One is a field with a date range and one of them is a buttonfield. I want to make it so that when a button is clicked, it will redirect them to a specific page with a formatted string similar to how it's done when a hyperlinkfield is clicked as such:

DataNavigateUrlFormatString="ProductInfo.aspx?ProductID={0}"

Is there a way I can do the same thing with a button?



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    September-05-2014 1:06 AM

Hi Manoj, 

Try using this type of column instead of a ButtonField:

<Columns>

   <asp:HyperLinkField

     DataTextField="ProductName"

     HeaderText="Product Name"

     SortExpression="ProductName"

     DataNavigateUrlFields="ProductID"

     DataNavigateUrlFormatString="ProductInfo.aspx?ProductID={0}" />

</Columns>


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

Follow MindStick