How maintain state for its controls..?

In this article I'm trying to explain how maintain state for it's controls. Client make a request server respond based on client request i the mean time controls maintain state or not. If it's maintain the state what happen inside to maintain the state. If it's not maintain the state what is the problem.

How maintain state for its controls:

• Client makes a request for page
• Server process the page and concatenates all the result into a string.
• This string is converted into base64 encoding format. Which is not encrypted and secured format.
• This data is now stored in hidden field. Which is created by (1 or more) implicitly.
• Now, the page is returned to client along with user created control and also hidden fields.


• Now, client modify & resubmits the page to server.
• Server first off all now reads the hidden field data so that it retains its previously given result. Then starts processing the page where old results and new values.
• It repeats this cycle for every client as long as client is working with current page.
• This result in state full behavior of page related to controls.


Source Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="State.aspx.cs" Inherits="State" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<form id="form1" runat="server">

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
HTML TextBox :
<input id="Text1" type="text" />
<br />

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />


Code Behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class State : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)
Label1.Text = "after click a button data will not store in DataSource";





No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: