Client Side State Management
(QueryString,Control State,Hidden Field,Cookie,ViewState)
For Cookies: Click to View Example
For ViewState: Click to View Example
1. QueryString :
A query string is information that is appended to the end of a page URL.
(QueryString,Control State,Hidden Field,Cookie,ViewState)
For Cookies: Click to View Example
For ViewState: Click to View Example
For Hidden Field : Click to View Example
For Control State: Click to View Example
1. QueryString :
A query string is information that is appended to the end of a page URL.
Query strings provide a simple but limited way to maintain state information. For example, they are an easy way to pass information from one page to another, such as passing a product number from one page to another page where it will be processed. However, some browsers and client devices impose a 2083-character limit on the length of the URL.
Example:
Country.aspx
<a href="clientsidestatemanagement.aspx?state=1" >USA</a>
<a href="clientsidestatemanagement.aspx?state=2" >INDIA</a>
State.aspx
in .cs page
Protected Sub Page_Load(Object sender,EventArgs e)
{
If (Request.QueryString.Get("state").ToString() <> "")
{
state = Request.QueryString.Get("state").ToString();
If (state = 1)
{
DropDownList1.Items.Add("newyork");
DropDownList1.Items.Add("California");
}
If (state = 2)
{
DropDownList1.Items.Add("Mumbai");
DropDownList1.Items.Add("Delhi");
}
}
2.
No comments:
Post a Comment