| ||||
Loading
| ||||
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Shakeel Iqbal122 reputationPosted Aug 16, 2009, 10:22 PM EDT
You can not save control/object in ArrayList, which are not serializable. if you are saving your own object in ArrayList then inherit your class from ISerializable interface.
deepa26 reputationPosted Aug 16, 2009, 11:12 PM EDT
The arraylist contains objects of a particular class. Is it a problem?
If i save some string in the arraylist then it does not give any problem. Is it to do with object in arraylist?
I dont get it...it goes to the Application_Error event in global.asax.cs.
The class is a non serializable class.
How do i resolve this? i need to store the arraylist in viewstate, because i require it on one button click event.
Shakeel Iqbal122 reputationPosted Aug 16, 2009, 11:52 PM EDT
Add serializable attribute on your class.
e.g
[Serializable]
public class MyClass
{
......
......
......
}
Solution#2
if your class has complex object. then inherit your class from System.Xml.Serialization.IXmlSerializable and override its methods.
deepa26 reputationPosted Aug 17, 2009, 1:51 AM EDT
it worked