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

in my page im having textbox,lable,gridview,button and when i click the button it should be get redirected and that new page should have the gridview. is there any chance to use session for the gridview like using for textbox?
Posted
Comments
Nilesh Patil Kolhapur 12-Apr-12 1:35am    
yes session is possible if u want to show same data on redirected paage
deepakaitr12345 12-Apr-12 5:15am    
HI @dineshdiku you can use the previouspage.findcontrol("gridview") mathod for this. Thanks

1 solution

Either you can use the previouspage.findcontrol("gridview") method
or the best way you can find is use the Messenger class.

Use Messenger's Send and Register method to send the data and receive the data from one page to another.

Write below code in the file which you have to send object.
Messenger.Default.Send<object_datatype>(object,token);</object_datatype>

Write below code in the file which you have to receive object
Messenger.Default.Register<object_datatype>(this,token,Action);</object_datatype>

where object_datatype is the datatype of the object or value which you have to pass.
object is a object or value which you have to pass.
token is the specification or you can say tag. with this Messenger will find the Register method which have same token. and execute that only method.

for eg:

Messenger.Default.Send<bool>(true,"SendingStatemet");<br />
       Messenger.Default.Register<bool>(this,"SendingStatement",(istrue)=><br />
       {<br />
         if(istrue)<br />
             this.DialogResult=istrue;<br />
        });</bool></bool>


Happy coding..
 
Share this answer
 

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