Problem persisting a collection within a property

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have created a Web control, and am trying to serialize a collection
that is a property of a class, and that class is a property of my
control. The following code is a simplified version of my control.
Can anyone tell me why the property and collection are not being
persisted as a property of the control?

using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Collections;
using System.Web.UI.Design;

namespace Oxcera.Web.UI
{
[TypeConverter(typeof(ExpandableObjectConverter))]
public class MyToolbars
{
public MyToolbars()
{
}

private ToolbarCollection m_Top;

/// <summary>
/// Left property
/// </summary>
[Category("Toolbars"),
PersistenceMode(PersistenceMode.InnerProperty),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
NotifyParentProperty(true),RefreshProperties(RefreshProperties.Repaint)]
public Oxcera.Web.UI.ToolbarCollection Top
{
get
{
if (m_Top == null) m_Top = new ToolbarCollection();
return m_Top;
}
}
}

public class MyControl : Control
{
public MyControl()
{
}

private MyToolbars m_Toolbars;

[Category("Misc"),
PersistenceMode(PersistenceMode.InnerProperty),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public MyToolbars Toolbars
{
get
{
if (m_Toolbars == null) m_Toolbars = new MyToolbars();
return m_Toolbars;
}
}
}
}

.



Relevant Pages

  • Re: How to prevent base class (UserControl) form being serialized
    ... but in the ideal situation you would have control over what is and is ... the base class so your control won't have a name, know its visibility, know ... them on the code for the UserControl. ... Just serialize this structure ...
    (microsoft.public.dotnet.general)
  • Re: Cant seem to add XmlIgnore override on inherited property
    ... attribute overrides. ... Your type MyControl has no member by the name Site. ... base type of Control. ... > not being able to serialize the Site property. ...
    (microsoft.public.dotnet.xml)
  • Re: How to prevent base class (UserControl) form being serialized
    ... My object happens to be derived from a control so I am penalizes for that. ... them on the code for the UserControl. ... derived control while leaving the base class un-touched. ... Just serialize this structure rather ...
    (microsoft.public.dotnet.general)
  • Re: Serialize a tree?
    ... > You really want to serialize the control? ... No, theres no reason, and in fact, I actually had a solution in mind ... save a tree in a tree format it'll save me some work. ... I'm not so much concerned with saving the control, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to prevent base class (UserControl) form being serialized
    ... the base class so your control won't have a name, know its visibility, know ... My object happens to be derived from a control so I am penalizes for that. ... them on the code for the UserControl. ... Just serialize this structure ...
    (microsoft.public.dotnet.general)