Click here to Skip to main content
14,327,460 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi,

i have a gridview in which it displays some columns not all of a SQL-Server database table

my SQLDataSource select is: SELECT id, Name, Age FROM Employees

now i want to click on a row in the GridView to redirect me to a page that shows all the columns of a record.

How can i click on a row in the GridView and redirect me to myPage.aspx?id=id


Thanks
Posted
Comments
CHill60 25-Sep-15 6:29am
   
What have you tried?
ahsal 25-Sep-15 6:49am
   
have i tried what ??!!
there is no answers
CHill60 25-Sep-15 6:54am
   
I mean, what have you done so far to solve this problem for yourself? What code have *you* written? What happens when you run *your* code?
See Some guidelines for posting questions in the forums[^]

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

As per my understand the thread your requirement is, If you click on gridview row, based on row id you wants to redirect to another page.

If that is your need, then use HyperLinkField of gridview, and use below properties

1) DataNavigateUrlFields : Query string fields
2) DataNavigateUrlFormatString : URL of that page

<asp:hyperlinkfield text="View" datanavigateurlfields="Id,Desc,Short_Desc" datanavigateurlformatstring="~/Page2.aspx?CL_Id={0}&CL_Desc={1}&CL_Short_Desc={2}" xmlns:asp="#unknown" />


Refer below link for more details
http://www.dotnetspider.com/resources/45377-How-pass-Gridview-Parameters-another-page-using-HyperLinkField.aspx[^]
   
Comments
ahsal 25-Sep-15 9:39am
   
i added the HyperLinkField before and it is working. but what i want is to click on anywhere on a row and redirect me to another page with the querystring of the id field

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100