
Viewstate is used for state management in asp.net on same page. We can also access the Viewstate on other aspx page. For this we need to use
server.transfer() method instead of
response.redirect() method to redirect to the other page.
Let us have an aspx page named
passviewstate.aspx . We will store two viewstates here as follow:
And use
server.transfer to redirect to another page named
readviewstate.aspx . We need to place a fuction of statebag class.
Now we will read these viewstate values on the page
readviewstate.aspx . For this we will create a function to read the the previous page's viewstate.
After creating the above function we will write code to show the viewstate values.
And we are done. Now we the values of two viewstate variables Name and Organisation in the labels lblMessage and lablOrganisation.
No comments:
Post a Comment