I am having problems serialising data for the view state. I am using VS2010 and when trying to add a property to the view state I get the following error message:
Error serializing value 'System.Collections.Generic.List`1[Access.ARW.Business.Filters.Parameters.Parameter]' of type 'System.Collections.Generic.List`1[[Access.ARW.Business.Filters.Parameters.Parameter, Access.ARW.Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].'
I have added a [Serializable] attribute above the classes I am trying to serialise but I still get this error...any ideas
Here is the property declaration which is in Class A:
private List<Filters.Parameters.Parameter> ReportParameters
{
get
{
if (ViewState["ReportParameters"] == null)
{
ViewState["ReportParameters"] =
new List<Filters.Parameters.Parameter>();
}
return (List<Filters.Parameters.Parameter>) ViewState["ReportParameters"];
}
set
{
ViewState["ReportParameters"] = value;
}
}
Did you miss adding the Serializable attribute to one of the components of the class? Try adding the parts of the class one-by-one to ViewState until you find the one that is wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With