Malaika Consultants LLC

Step 5: ASP.NET View-State

by Jane Thomson 1. May 2011 23:31

After learning a web form and few of the ASP.NET controls, let us look at one of the prime feature of ASP.Net known as View-State. If you have been as ASP developer, you must know that once you submit the form, all the values from the form are cleared. Now, suppose the server comes up with error! Haah, that’s really a bad situation for user and has to refill all the information on the form, and that’s something you want to avoid as a developer.

ASP.NET View-State feature provides exactly the same. As a user if you find that the value you submitted still remains there even if the server gives an error and you press back button, think blindly that the web page is developed with ASP.NET View-State feature.

Basically, ASP.NET View-State is a method used by the ASP.NET pages to persevere the changes of state of a web form across the postbacks. Actual thing is that the ASP.NET maintains the view-state of your form. View-State defines the value of the web page at the time of submission to server. The current status of the web form is maintained with a hidden element places on each of the page with a form control.

It’s a default setting of ASP.NET to maintain the View-State of ASP.NET. In case, if you do not want to maintain a View-State of a web form, you shall include directive, <%@ Page EnableViewState="false" %> on top of the web form. Or else you can also add the element EnableViewState = “false” to any of the controls on the page.

A developer shall use ASP.NET View-State if he/she wants to achieve one of the below features in web page:

·         Save the form values between postbacks even without saving it in a user profile.

·         Save page control property values defined by a developer.

·         If a developer wants to store the view-state information in any data storage.

For Step 6 please click here.



::: | © Malaika Consultants LLC | :::

Malaika Consultants LLC

Malaika Consultants LLC is a custom software development consulting firm located in Cary (Raleigh Durham Research Triangle AKA RTP area ) North Carolina. We offer our expert consulting services in the Microsoft .NET and related technologies. Our mission is to partner with you and ensure the success of your project. We have a team in the USA that will help you with your Information Technology needs and we strive to be truly "Your Information Technology Angels"

We are offering 1 hour of free consulting -- ASP.NET, SQL Server, IIS, anything. Contact us to get your free consulting

Recent Comments