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

Answer Posted / vijaykumar

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 ?    41 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the usie of activex control in .net?

562


What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.

603


Can you edit data in the Repeater control? Which template must you provide, in order to display data in a Repeater control? How can you provide an alternating color scheme in a Repeater control? What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?

556


What are cookies in asp.net?

578


What is a ashx file?

558






What is a Cookie? Where is it used in ASP.NET?

612


What are the different properties of server control that exists?

569


What are the two properties that are common on every validation control?

559


Demonstrate Render and PreRender?

603


Difference between web user control and web custom control?

504


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

670


What is the syntax for datagrid and specifying columns?

2095


Explain how does asp page work?

578


What are web server controls in asp.net?

556


Can you change a Master Page dynamically at runtime?

581