C# ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT WPF
C# OOPS HTML&CSS DHTML ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT MVVM WPF SQL SERVER Photoshop Dreamweaver Flash Illustrator
Blog Archive
-
2012
(83)
- September(2)
-
August(81)
- Important WPF Classes and Namespaces
- Applications of WPF
- Programming With WPF
- Limitations of Silverlight and flash
- Silverlight Feature comparison with Flash Features
- How to Add XML File in Your Silverlight Project
- 3 Pixel Shader Effects in Silverlight
- Rotate Image in 3D direction using Silverlight
- First Application of Silverlight
- Silverlight 2.0
- How Install Ajax?
- Ajax Advantage
- JavaScript Loops
- Show a Military Clock and ordinary clock
- How To validate a Form in ASP. Net
- How to show Day of Week
- How to Swap a Image using JavaScript
- Special Character in JavaScript
- Prompt Box in JavaScript
- The use of data adapter.?
- The steps involved to fill a dataset?
- Dataset object in ADO .NET
- Handling Connection Events
- The SQLCONNECTION OBJECT
- Command Constructors
- The SQLCOMMAND OBJECT
- Gridview in ASP.NET
- Introduction Of Master Page
- Server Side State Management
- Query String In ASP.NET
- Cookies in ASP.NET
- State Management in ASP.NET
- Various types of application that we can develop i...
- Properties
- Inheritance ,Polymorphism
- Array,Indexer and Collections
- Control Statements
- Operators, types and variables in C#
- Fundamental of C#
- C# & other Programming Languages
- The WPF Designer
- C# DataTypes
- What is Ajax?
- Silverlight 1.0
- Confirm Box in JavaScript
- Component classes
- Life Cycle of ASP.NET
- The Basics of JQuery
- Jquery Blog Content
- Birth Of WPF
- .Net Frameworks Architecture
- History Of Ajax
- Why Silverlight?
- How to access a URL of parent page in ASP. net
- THE ADO.NET Architecture?
- Architecture of ASP.NET
- Introduction Of Ajax
- Ajax Blog Content
- Introduction of SilverLight
- Silverlight Blog Content
- Introduction to Javascript Blog
- Javascript Blog Content
- Introduction to Ado.Net blog
- Ado.Net Blog Content
- Introduction to C# Blog
- C# Blog Content
- Introduction to Asp.Net
- Asp.Net Blog Content
- Introduction to WPF
- WPF Blog Content
- WPF Interview Question
- Silverlight Interview Question
- Ajax Interview Question
- JQuery Interview Question
- Javascript Interview Question
- DHTML Interview Question
- Ado.Net Inetview Questions
- SQL Interview Questions
- HTML&CSS Interview Questions
- Asp.Net Interview Qusetions
- C# Interview Questions
State Management in ASP.NET
State Management in ASP.NET
State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
Types of State Management
Client – Side State Management
ASP.NET provides various client side state management options like Cookies, Query Strings (URL), Hidden fields, View State and Control state (ASP.NET 2.0).This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator (url), or a cookie. The techniques available to store the state information at the client computer.
a. View State – Asp .Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp .net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.
Example of View state
Write code in .aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ViewState</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" id="NameField" />
<asp:Button runat="server" id="SubmitForm" onclick="SubmitForm_Click"
text="Submit & set name" />
<asp:Button runat="server" id="RefreshPage" text="Just submit" />
<br /><br />
Name retrieved from ViewState: <asp:Label runat="server" id="NameLabel" />
</form>
</body>
</html>
|
.Cs Code
protected void Page_Load(object sender, EventArgs e)
{
if (ViewState["NameOfUser"] != null)
NameLabel.Text = ViewState["NameOfUser"].ToString();
else
NameLabel.Text = "Not set yet...";
}
protected void SubmitForm_Click(object sender, EventArgs e)
{
ViewState["NameOfUser"] = NameField.Text;
NameLabel.Text = NameField.Text;
}
|
Advantages
The main advantage of view state is persisting controls properties without any
programming and memory will not be occupied on the client system or on the server system.
Disadvantage
The disadvantage can be considered as a lot amount of data transmission between client and server.
-
Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.
-
Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.
-
Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.
-
Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.









