I am once back with a blog/article/tutorial whatever you think/call it.
State Management in ASP.NET :
HTTP Protocol is State less protocol. In Simple Language, Each and Every time We send a request to server, this is New to server.
To Understand this ,Suppose you took One Textbox and Two Buttons like in Image below:
Now, the task is To Enter Number in Textbox and Click in First Button to Convert to Integer format and then Click Second button to Print Square of Converted Integer in Textbox. What will you do. Lets look at code what I did here.
protected void Page_Load(object sender, EventArgs e)
protected void Button1_Click(object sender, EventArgs e)
x = Convert.ToInt32(TextBox1.Text);
protected void Button2_Click(object sender, EventArgs e)
TextBox1.Text = Convert.ToString(x * x);
Now what would I get Result on Second Button Click event. Textbox Result will be 0 even I have entered any number. Don’t agree, try this at home.
This is Because, at the time of Button2 Click new request is send to server and Initial Value of X is picked from server which is 0.
To Prevent the Loose of Data each time we send request to server, ASP.NET have implemented concept of State Management.
State Management is divided into 2 parts according to Functionality.
1) User Based State Management in ASP.NET
- Hidden Fields
2) Server Based State Management in ASP.NET
I am going to Describe all these States step by step in Different Posts.
All the Series has been posted on DotNetSpider at below Link Resources > Keep Reading.