Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Am doing example on gridview ..in grid i have taken one link button,

after clicking that link button ,i want to send all data of selected row to next page.

can anybody tell me..?

thanx
Posted
Comments
Dixit Ashish 24-Oct-13 4:16am    
???

There are two ways to achieve that:

1)client side
2)Server side

With client side approach you can use query strings or cookies to pass the values to the next page. For that you will have to bind the client side onclick function to your link button using RowDataBound event of gridview. To read about RowDataBound event visit:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx[^]

http://www.dotnetgallery.com/kb/resource17-RowDatabound-event-tips-and-tricks-in-Gridview-control.aspx[^]

With server side approach you will have to use RowCommand event of your gridview and store the details. Probably using Session object. On the next page you can access the details. To read about RowCommand event visit:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx[^]

http://www.c-sharpcorner.com/uploadfile/syedshakeer/rowcommand-event-in-gridview/[^]

If I would be doing this, I would have opted the first option but I would have used ID of the row as query string to pass to the next page so that the data could be retrieved from Database. That could have also resulted in retrieval of accurate data in case someone else modify the data in between the process.
 
Share this answer
 
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900