views:

18

answers:

1

I have a GrideView bound with table, I added one hyperlinkfield as you can see the code below:

<asp:HyperLinkField NavigateUrl="~/Logout.aspx?category=Mobile&&ID=" Text ="logout"/>

As you can see that I am sending 2 QueryString with URL. I am getting both correctly as long as I am sending static data. The problem is that I want to send one of my Grideview column value through QueryString something like this i want and I tried:

<asp:HyperLinkField NavigateUrl="~/Logout.aspx?category=Mobile&&ID='<%GridView1.SelectedRow.Cells(1).Text.ToString%>'" Text ="logout"/>

I am not getting the ID value as per column value but the same Gridview code like this "GridView1.SelectedRow.Cells(1).Text.ToString". How should I correct this syntax so i can send my column value through URL. Thanks...

A: 

You'll have to convert the field to a template field and bind the asp:HyperLink's NavigateUrl property in the DataBound event of the GridView.

Examples can be found here (using BulletedList instead of HyperLink):
http://msdn.microsoft.com/en-us/library/aa479353.aspx

Jim Schubert