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

My question is that I have some data in gridview which is in page1.aspx and I want to move to page2.aspx from page1 with only selected rows of gridview, so how can I do this with the help of session.

Can anybody please help me with this. As I am new to session, I want to understand it. Please give me your reply with the help of session.

And also can anyone tell me whether this is the right way to use session in such condition?
Posted
Updated 24-Aug-10 8:22am
v3
Comments
LittleYellowBird 24-Aug-10 11:40am    
Hi, there is no need to shout. I have removed the all capitals from your title as it appears to be shouting and is very rude. I have also tidied up the English a bit for you. Good Luck with your problem. :)

Are you willing to learn? if So here [^] is all you need to know about sessions in order to do your job.
 
Share this answer
 
There can be other ways to transfer data from one page to other. Based on your scenario of having Grid data shared across pages, Session can be used.

If you have a Cross Page postback [^], then you can use PreviousPage property and get the data of the previous page.

You can also pass on the selected rows unique id's in your URL as query string and then use them to get appropriate data. Pick the one that suits your website.
 
Share this answer
 
v2
you can put your data to sesssion like

Session["Data"] == /* put your datarow instance here */


and retrieve same on the othe page.

if(session["Data"] != null)
{
DataRow _rowInstance = (DataRow)Session["Data"];
}


and if you want to explore session use this KB Article

C#
Thanks,
Hiren Solanki
{Mark as A Answer if it helps }
 
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