I need to store some lists into a ViewState.
I created a class:
[Serializable]
public class TemplateTypeProcedureListViewState
{
public string Name { get; set; }
public string ProcedureName { get; set; }
public string ProcedureParameter { get; set; }
public string ProcedureParameterType { get; set; }
}
Here is the ViewState:
private TemplateTypeProcedureListViewState TemplateTypeProcedureList
{
get { return (TemplateTypeProcedureListViewState)ViewState["TemplateTypeProcedureList"]; }
set { ViewState["TemplateTypeProcedureList"] = value; }
}
I'm giving the values like this:
var templateTypeProcedureListViewState = new TemplateTypeProcedureListViewState
{
Name = ListNameTextBox.Text,
ProcedureName = ListProcedureNameTextBox.Text,
ProcedureParameter = ListProcedureParameterTextBox.Text,
ProcedureParameterType = ListProcedureParameterTypeTextBox.Text
};
ViewState.Add("TemplateTypeProcedureList", templateTypeProcedureListViewState);
Now, when I add another item, the first one is overwritten (or deleted and the other one (second) is saved). Is it possible to save more than one item into a ViewState? Can you refer me something or somewhere? Thanks :)