Last post Dec 13, 2009 11:43 PM by vijay_010237866
Dec 13, 2009 09:27 PM|morningsunshine|LINK
I am trying to create an asp.net custom control that acts as a hosting container for any other controls, similar to the existing ‘Panel’ control. Basically, I need to build a web control that groups a bunch of other controls. It will consist of a header
Ideally I want to create a control that packs the whole thing together, so at design time I could use the following markup.
<myCtl:SuperContainer runat=”server” Title=”User Details”>
<asp:label id=”lblName” runat=”server” text=”Name:”/>
<asp:textbox id=”txtName” runat=”server”/>
<asp:label id=”lblDOB” runat=”server” text=”Date of Birth:”/>
<asp:textbox id=”txtDOB” runat=”server”/>
(…other controls definition…)
I plan to include two panels in my control, one for the header and another one for the body, but as you can see, the key issue is to find a way to ‘divert’ the child controls that are defined in the markup to the body panel, instead of the default parent
container. I feel it can be some how simply override (manipulate) the control property, but don’t know how to properly do so.
Can any one give some idea about how to implement this ‘SuperContainer’ control?
Dec 13, 2009 11:43 PM|vijay_010237866|LINK
u need to make a function inside custom control that can add controls in order inside it
and from code u would simply call that function like
and it would append in the body of that control
similarly u can add other controls.