There are many ways of persisting form data after the form has been submitted. Some of the more popular ways include the following:
The values of form fields can be stored in the Session object. Data can be added to the Session object with a line like this (in ASP.NET):
Session("Name") = "Mike Davis";
Session information can be stored in various locations: inside the ASP.NET runtime process, inside a dedicated Microsoft Windows® service, or inside a Microsoft SQL Server™ database. However, using the Session object, in any of these locations, is costly in server memory. In addition, you have to read the values out of session and put them back into the form on each page load. This routine code bulks up your pages.
Another option to persisting data is to duplicate your form content in a hidden field that is posted back to the server. The HiddenField control is used to store a value that needs to be persisted across posts to the server. It is rendered as an <input type= "hidden"/> element. Normally view state, session state, and cookies are used to maintain the state of a Web Forms page.
Post a Comment