How to create server control of Container Type

H

hungrymind

Hi All,

I am trying to build one server control which has one panel and within
this panel there will be two more panel. I have created two instance of
MyPanel class (inherited by Panel), it works fine in design as well as
runtime. The problem is I want user to be able to add controls on
designtime to the inner panel. Can any body tell me how to achieve
this? I tried inheriting MyPanel class with IContainer, still its not
working. When I inherit the main control with Panel, I am able to add
controls in design time while same I am doing for Inner Panel, its not
working. Also I have tried adding InnerPanel (MyPanel) in Render, Init
method, Constructor of controls, but neither way it worked. Can any
body suggest where I am doing wrong.

wishing you all in anticipation,

warm regards,
- hungrymind
 
G

Gary Vidal

Use ITemplate and in the CreateChildControls


///Property
public ITemplate PanelTemplate
{
get{return m_PanelTemplate;}
set{m_PanelTemplate = value;}
}

///createchildcotnrols

m_PanelTemplate.InstantiateIn(panelToInstantiate);
//add any additional controls to the template

Gary Vidal
 

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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top