all groups > asp.net building controls > july 2005 >
You're in the

asp.net building controls

group:

Problem Working with Composite Control



Problem Working with Composite Control zen
7/26/2005 12:00:00 AM
asp.net building controls:
Hi All,

I have designed a control derived from WebControl, which contains lis
of another control derived from PlaceHolder,INamingContainer.

The UML design of the Class is attached ..[image: ClassDesign.JPG]

Now the problem is..
I am adding a user control,derived from WebControl, insid
PlaceHolder(iSlidingPanel in the diagram) . I am registering som
clientside java scripts OnLode of this control. These scripts ar
necessary to lode the control in the client side.These scripts are no
registered on the client as OnLode of this control itself is no
called.

while debuging i found that, for the controls inside th
PlaceHolder(iSlidingPanel in the diagram) the Init And OnLoad event
are not fired. Directly render is being called.

I will be thankful if some one help me regarding this.

Thanks and Regards
Zen

+-------------------------------------------------------------------
|Filename: ClassDesign.JPG
|Download: http://www.highdots.com/forums/attachment.php?attachmentid=165
+-------------------------------------------------------------------

--
ze
-----------------------------------------------------------------------
zen's Profile: http://www.highdots.com/forums/member.php?userid=49
View this thread: http://www.highdots.com/forums/showthread.php?t=220804
Re: Problem Working with Composite Control sam
7/26/2005 4:06:28 PM
controls play catchup for page events. when you add the controls to
the placeholder they will 'catchup' to whatever stage in the lifecycle
the placeholder is in.

when do you add the controls to the placeholder? when do you add the
placeholder to the control? When do you add the control to the page?

we need this information to answer.

as far as i know it is flat out impossible for these events not to be
fired for an added control.
Re: Problem Working with Composite Control zen
7/27/2005 10:31:13 AM

Thanks for your reply Sam!
I am adding the controls to the PlaceHolder in design time. Please loo
at the code bellow which i added to the page,

< Ctl:iSlidingPanleContainer id="ISlidingPanleContainer2
runat="server" >
<Ctl:SlidingPanel ID="slidingPanel1" runat="server">
SOME TEXT
</Ctl:SlidingPanel>
<Ctl:SlidingPanel ID="slidingPanel2" runat="server">
<Ctl:iTextBox id="mybox" runat="server
text="MyText"></isoft:iTextBox>
</Ctl:SlidingPanel>
</Ctl:iSlidingPanleContainer>

Here, SlidingPanel is derived from PlaceHolder which is contained b
iSlidingPanelContainer. iTextBox is another control placed inside th
PlaceHolder. As I said earlier if I put the iTextBox directly on th
page it is working fine. If I put the iTextBox as shown above, th
logic I wrote in PageLoad is not being executed. Hence the JavaScript
registered in PageLode will not be available at runtime.

Please Let me know if you need anymore details regarding this.
Thanks & Regards
Ze

--
ze
-----------------------------------------------------------------------
zen's Profile: http://www.highdots.com/forums/member.php?userid=49
View this thread: http://www.highdots.com/forums/showthread.php?t=220804
Re: Problem Working with Composite Control sam
7/27/2005 5:08:20 PM
I saw something on the web about how you can't nest tags this with
placeholders but must use panels instead. I don't know if its true or
not.

Can you add the control yourself in the OnInit() method of the
SlidingPanel, i.e.
override void OnInit() { this.Controls.Add(new iTextBox()) }

BTW, most ppl register javascript statements by overloading
OnPreRender, but I have a feeling that won't work for you either.
AddThis Social Bookmark Button