What a PITA. If you want to store an object in the viewstate in ASP.net you need to make sure it is marked as Serializable. Not only that, you need to make sure that every class that it uses is marked as serializable.
There are some scenarios that you don’t have to thought: if you store the objects in Session, you will be ok – unless you try to use out of proc sessions, then you will get the same error for sessions except it will say ‘Class’ must be marked as Serializable or have a TypeConverter other than ReferenceConverter to be put in Session.
If you can, try not to store complex objects in Session/Viewstate and you will save yourself the headache. Or hope that your complex object doesnt use any other classes, then it will be easy for you. :)