T
tshad
I have a page that is using a List collection (list<>) and I want to save it
across postbacks.
I tried adding it to my ViewState but get an error:
Type 'AutoUPS.ClientList' in Assembly 'AutoUPS, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' is not marked as serializable.
How do I set this up so I can save it?
In my web page I am doing:
public partial class AutoUPS : System.Web.UI.Page
{
private int exceptionDrop;
public static ClientList clientList = new ClientList();
...
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
else
{
clientList = (ClientList)ViewState["ClientList"];
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ViewState["ClientList"] = clientList;
}
I am calling this from another page so I have my ClientList set as a static
and then want to save it so I don't have to call the database all the time.
Not sure if this is the best way but it seemed so.
Thanks,
Tom
across postbacks.
I tried adding it to my ViewState but get an error:
Type 'AutoUPS.ClientList' in Assembly 'AutoUPS, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' is not marked as serializable.
How do I set this up so I can save it?
In my web page I am doing:
public partial class AutoUPS : System.Web.UI.Page
{
private int exceptionDrop;
public static ClientList clientList = new ClientList();
...
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
else
{
clientList = (ClientList)ViewState["ClientList"];
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ViewState["ClientList"] = clientList;
}
I am calling this from another page so I have my ClientList set as a static
and then want to save it so I don't have to call the database all the time.
Not sure if this is the best way but it seemed so.
Thanks,
Tom