storing objects in ViewState

D

D Wicker

Hello,
I'm developing a web custom control and am trying to store an instance of a
class
in the ViewState and keep getting an exception:

"The type 'MyClass' must be marked as Serializable or have a TypeConverter
other than ReferenceConverter to be put in veiwstate."

I've marked the class with [Serializable] like below:
[Serializable]
public class MyClass
.......

But I still get the same exception.

I'm trying to store this instance of 'MyClass' in the ViewState in the
CreateChildControls() method. Also MyClass has members of other classes
that I have also marked each one of those Serializable also. I'm pretty new
to building custom web controls so maybe there's something obvious that I'm
missing?

Any suggestions?
Thanks for any replies.
Donnie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top