How to store simple data types in ViewState?

Tripati_tutu
Posted by Tripati_tutu under ASP.NET category on | Points: 40 | Views : 3498
From all types of state management techniques in ASP.NET, ViewState is to be dependent for support on a dictionary collection, and each item is indexed with a unique string name. Below is the sample
ViewState["NameVariable"] = "DotNetFunda";

You can also access the above variable anywhere within the page/control where the ViewState variable has been added. Below is the sample
string Name = (string) ViewState["NameVariable"];

Comments or Responses

Login to post response