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 custom events? How to create it?

814


Define cookie.

751


Can you explain one critical mapping? Performance issue which one is better? Whether connected lookup tranformation or unconnected one?

1014


How does the cookies work in asp.net?

741


What is web router?

674


In a Repeater control how one can provide an alternating color scheme ?

777


Explain the advantages of passport authentication.

682


What is the significance of finalize method in .net?

760


Give a few examples of page life cycle events.

873


Is it possible to migrate visual interdev design-time controls to asp.net?

779


What are the authentication types in asp.net?

771


Where the assembly is stored in asp.net?

733


Explain the asp.net mvc folder conventions? : asp.net mvc

709


What is clickid?

758


How do you do client-side validation in .net? How to disable validator control by client side javascript?

736