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



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

Answer / 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

More ASP.NET Interview Questions

What are Session states available and its Uses?

0 Answers   CTS, iLogic,


What is a viewbag?

0 Answers  


Where is cookie used in asp.net?

0 Answers  


Which tool you have done?

0 Answers  


How can u deifne the benefits and limitation of using Viewstate for state management?

0 Answers   QuestPond,






How do you install windows service?

4 Answers   Tech Mahindra,


page life cycle of asp.net.

4 Answers  


What is the transport protocol you use to call a Web service?

2 Answers   Siebel Systems,


Can you create an app domain ?

1 Answers  


Explain ViewState?

0 Answers   QuestPond,


Explain repository pattern in asp.net mvc? : asp.net mvc

0 Answers  


benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks

0 Answers   HCL,


Categories