View State How to use in Asp.net
Introduction : This Tutorial Explain How to use View state in Asp.net. using the ViewState we can store some page or form data or information from the current page before the page is postback. if we can not use the view state and page is postback the data or information of the page will be lost. thus it can be need to maintain view State in asp.net.
Here we are giving syntax of view state how to use in .net.
ViewState["name"]=TextBox1.Text;
ViewState["password"]=TextBox2.Text;
ViewState["password"]=TextBox2.Text;
Here, ViewState["name"] is store the TextBox1 data from the user enter and ViewState["password"] TextBox2.Text data when the page is postback or page data will lost then view state can be retrieve these data from it ViewState.
If ViewState data is not null then we can retrieve these data using the following given Syntax
if (ViewState["name"] != null & ViewState["password"] != null)
{
TextBox1.Text = ViewState["name"].ToString();
TextBox2.Text = ViewState["password"].ToString();
}
{
TextBox1.Text = ViewState["name"].ToString();
TextBox2.Text = ViewState["password"].ToString();
}
By using view State it can be solve the page postback problem and maintain the form or page data until the page are not close.
See Other Tutorial :
* AngularJS Crude With ASP.NET MVC
* Convert Rows to columns using 'Pivot' in SQL Server
* Mvc Registration page With user exist using Ajax method
* MVC 4 How to Perform Insert Update Delete Edit Select Operation
* MVC4 Edit,update,Delete,cancel inside gridview using sql database
* MVC 4 Gridview To Display Data Using SQL Server Database With Simple code
* Login page in asp.net Mvc4 Web application
* Mvc4 How to bind Dropdown List using Sql Database
* Gridview find control in asp.net
See Other Tutorial :
* AngularJS Crude With ASP.NET MVC
* Convert Rows to columns using 'Pivot' in SQL Server
* Mvc Registration page With user exist using Ajax method
* MVC 4 How to Perform Insert Update Delete Edit Select Operation
* MVC4 Edit,update,Delete,cancel inside gridview using sql database
* MVC 4 Gridview To Display Data Using SQL Server Database With Simple code
* Login page in asp.net Mvc4 Web application
* Mvc4 How to bind Dropdown List using Sql Database
* Gridview find control in asp.net
Sign up here with your email
ConversionConversion EmoticonEmoticon