can we transfer data from one page to another page using
viewstate if so how?if not y?

Answer Posted / alb.shah

Yes.
View state is page specific; it contains information about
controls embedded on theparticular page. ASP.NET 2.0
resolves this by embedding a hidden input field
name,__POSTBACK . This field is embedded only when there is
an IButtonControl on thepage and its PostBackUrl property is
set to a non-null value. This field contains the viewstate
information of the poster page. To access the view state of
the poster page, you canuse the new PreviousPage property of
the page

Page poster = this.PreviousPage;

Then you can find any control from the previous page and
read its state

Label posterLabel =(Label)poster.findControl("myLabel");
string lbl = posterLabel.Text;

This cross-page post back feature also solves the problem of
posting a Form to multiplepages, because each control, in
theory, can point to different post back URL.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the code Access Security (CAS) in .net Framework?

664


Explain the difference between inline and code behind - which is best in?

502


How can you dynamically add user controls to a page?

506


What are the advantages and disadvantages of Using Cookies?

516


Explain diff. Betn dataset and recordset?

544






Write a code snippet to implement the indentation in json in web api.

574


what is DLL Hell and how it is solved in .NET? please explain clearly??

1881


List of words of preprocessor in .net?

514


How to find last error which occurred in Asp.net ?

678


What are the asp.net list controls and difference between them?

512


What is the use of web.config and machine.config files?

623


In the Repeater control which way you can edit?

641


What is data caching?

547


Describe the application event handlers in ASP.NET?

542


What is http only cookie?

496