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 the steps involved to fill a dataset?

0 Answers  


How to you can limit Access to Web API to Specific HTTP Verb?

0 Answers  


How do you enable tracing? a) Set the Trace property of the Web Form to True b) Set the Trace property of the server object to True c) Set the Session variables Trace to True d) Set the Applications Variable Trace to True.

2 Answers   Syntax Softtech,


Differentiate session and cookie

1 Answers  


What is the difference between Session and response.Redirect?

0 Answers   Microsoft,






How can we identify that the Page is Post Back?

0 Answers  


How we can force all the validation controls to run?

0 Answers  


Where is cookie used in asp.net?

0 Answers  


What is Partial in ASP.NET 2.0?

2 Answers   Fulcrum Logic,


What is the used of "ispostback" property?

0 Answers  


How to write unmanaged code and how to identify whether the code is managed /unmanaged?

4 Answers   Accenture,


What is cached data phone?

0 Answers  


Categories