Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

Javascript Serialization Error

I'm save and restoring an object across postbacks using ViewState, like this:

So I save it using ViewState like this:

ViewState("MyObject") = object

and retrieve it like this:

Return ViewState("MyObject")

Since this is an object, I assume .NET is trying to serialize it.

I am getting a javascript serialization error.  See images.

I'm at a total loss.  Any ideas on this?
javascripterror1.png
javascripterror.png
Avatar of HLRosenberger
HLRosenberger
Flag of United States of America image

ASKER

I found this article.  When I use Session to save/restore my object, all is OK.

http://stackoverflow.com/questions/925553/cannot-serialize-object-to-viewstate-only-session 

Could anyone expand on this?  I'm not an expert at serialization and I'm trying to understand.   I really want to use ViewState, not Session.   Can I serialize the object myself using BinaryFormatter and then save to ViewState?
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.
Did you mean to give the B grade?
The grading system is a bit different here, have a look at this: http://support.experts-exchange.com/customer/portal/articles/481419-what-grade-should-i-award-