K
karimL
hi,
could you help me on this ?
i've got a webcontrol that have an other webcontrol as a private member.
I want this private member be accessible from my "container" control as
a property...but it seems not to work at design time...
Once I edited and closed my custom "contained" control , all its
properties are lost and then the "container" control cannot "save" its
properties too...
Shall I have to do something special ?
The "contained" control ...
[
ToolboxData("<{0}:LBC_ToolBar runat=server></{0}:LBC_ToolBar>")
,ToolboxItem(true)
,DesignTimeVisible(true)
,ParseChildren(true)
,PersistChildren(false)
]
public class LBC_ToolBar: WebControl, INamingContainer
and for the collection property
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
PersistenceMode(PersistenceMode.InnerProperty),
NotifyParentProperty(true)
]
public LBC_ToolBarItemCollection Items
{
get
{
if(_itemlist==null)
_itemlist=new LBC_ToolBarItemCollection();
return _itemlist;
}
}
the "container" control...
[
ToolboxData("<{0}:LBC_Thumbnail runat=server></{0}:LBC_Thumbnail>")
]
public class LBC_Thumbnail : WebControl, INamingContainer
{
public LBC_LIB.WebControls.ToolBar.LBC_ToolBar ToolBarDatas
{
get { EnsureChildControls(); return _toolbar; }
}
protected override void CreateChildControls()
{
if ( _toolbar==null)
{
_toolbar= new LBC_LIB.WebControls.ToolBar.LBC_ToolBar();
_toolbar.ID="TB_"+this.UniqueID;
}
}
}
thanks
Karim
could you help me on this ?
i've got a webcontrol that have an other webcontrol as a private member.
I want this private member be accessible from my "container" control as
a property...but it seems not to work at design time...
Once I edited and closed my custom "contained" control , all its
properties are lost and then the "container" control cannot "save" its
properties too...
Shall I have to do something special ?
The "contained" control ...
[
ToolboxData("<{0}:LBC_ToolBar runat=server></{0}:LBC_ToolBar>")
,ToolboxItem(true)
,DesignTimeVisible(true)
,ParseChildren(true)
,PersistChildren(false)
]
public class LBC_ToolBar: WebControl, INamingContainer
and for the collection property
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
PersistenceMode(PersistenceMode.InnerProperty),
NotifyParentProperty(true)
]
public LBC_ToolBarItemCollection Items
{
get
{
if(_itemlist==null)
_itemlist=new LBC_ToolBarItemCollection();
return _itemlist;
}
}
the "container" control...
[
ToolboxData("<{0}:LBC_Thumbnail runat=server></{0}:LBC_Thumbnail>")
]
public class LBC_Thumbnail : WebControl, INamingContainer
{
public LBC_LIB.WebControls.ToolBar.LBC_ToolBar ToolBarDatas
{
get { EnsureChildControls(); return _toolbar; }
}
protected override void CreateChildControls()
{
if ( _toolbar==null)
{
_toolbar= new LBC_LIB.WebControls.ToolBar.LBC_ToolBar();
_toolbar.ID="TB_"+this.UniqueID;
}
}
}
thanks
Karim