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 ways to improve performance in .net application?

7 Answers   Mind Tree,


What is difference between View State and Hidden Field in ASP.NET?

0 Answers  


What is the difference between Session and response.Redirect?

0 Answers   Microsoft,


What's the ASP.Net Application life cycle?

0 Answers   Wipro,


Explain model, view and controller represent in an mvc application? : asp.net mvc

0 Answers  






What are Authentication mechanisms in .Net?

6 Answers   Accenture,


Explain About duration in caching technique

0 Answers   BirlaSoft,


Give me one example of Web API Routing?

0 Answers  


What are the different ways you would consider sending data across pages in ASP (i.e between 1.asp to 2.asp)?

1 Answers   Net Solution,


What is a multilingual website?

0 Answers  


What are the components of ado.net?

0 Answers  


What is a web api?

0 Answers  


Categories