referencing control from other webcontrol

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
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top