I have a few custom controls, inherited from CompositeControl. I implement ISerializable for each control. This is one example:
[
AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
DefaultProperty("ID"),
ToolboxData("<{0}:EddRadioButtonList runat=\"server\"> </{0}:EddCheckBox>"),
Serializable
]
public class EddRadioButtonList : CompositeControl, IChannelControl,ISerializable
{

...
#region ISerializable_implementation
[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.FullTypeName = EDDQuestionID().ToString();
info.AddValue("ControlType", GetType().Name);
info.AddValue("ControlID", ID);
info.AddValue("Question", Question);
info.AddValue("Answer", EDDAnswerValue());

}
#endregion
...
}


I have a custom collection of these control. I also mark [Serializable]:
[Serializable]
public class EddControlCollection : CollectionBase
{
....
}

In my main class, I serialize and deserialize the collection of controls:

public void Serialize()
{
Stream s = File.Open("EDDTemp.xml", FileMode.Create);
//SoapFormatter formatter = new SoapFormatter();
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(s, _EDDControls);
s.Close();
}
public void Deserialize()
{
if (File.Exists("EDDTemp.xml"))
{

Stream s = File.Open("EDDTemp.xml", FileMode.Open);
//SoapFormatter formatter = new SoapFormatter();
BinaryFormatter formatter = new BinaryFormatter();
_EDDControls = (EddControlCollection)formatter.Deserialize(s);
//object o = formatter.Deserialize(s);
s.Close();
}
}

I have an error when I call Deserialize( ). It complained that the constructor to deserialize an object of type '....EddSubmitButton' was not found. EddSubmitButton is one of my custom control. How can I deserialize the custom controls properly?

I'm thinking I only want to serialize enough information to recreate the controls on the fly, but I seem to have a problem.

Thanks in advance.