[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Joe

2/9/2004 4:20:00 AM

Jeff,

I have understood what you mean, thank you.

joedirt


""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
news:9Bjkhs66DHA.1988@cpmsftngxa07.phx.gbl...
>
> Hi joedirt,
>
> Thank you for posting in the community!
>
> Based on my understanding, you created a usercontrol which use bubble
> technical for its child controls. And you want to add this usercontrol
> dynamically.
>
> ==============================================
> In your post, I found there are 2 questions:
> 1). What if I've already done allot of the page in init and load and need
> to react to the event bubbled to change the main content?
> 2). build the page in OnPreRender, the events in your usercontrol does not
> fire.
>
> For your questions, what does your "page" mean? I suppose your "page" word
> means the usercontrol. That is:
> 1). you use TemplateControl.LoadControl Method to add your usercontrol in
> Init or Load event.
> 2). You dynamicly Load the usercontrol in OnPreRender
>
> I think you should be fully understand the lifecycle of the Asp.net
control
> model. Please refer to the 2 articles below:
> "Control Execution Lifecycle"
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/c...
> l/cpconControlExecutionLifecycle.asp
> "The Life and Times of a Server Control"
> http://www.takempis.com/aspnet_co...
>
> Actually, OnBubbleEvent determines whether child controls' event fire. It
> fires when your child controls' event fire and invoke
> Control.RaiseBubbleEvent method. So it is determined by the its child
> controls' event.
>
> While in the LifeCycle of control, the postback event is handled through
> IPostBackEventHandler.RaisePostBackEvent(As you can see in the upper 2
> articles).
> OnPreRender event happens after IPostBackEventHandler.RaisePostBackEvent,
> so if you Load your control in OnPreRender, there is no chance to fire the
> postback event. For more information, please refer to:
> "Capturing Postback Events"
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/c...
> l/cpconreceivingpostbackeventnotifications.asp
> and "Postback Event Sample"
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/c...
> l/cpconpostbackeventsample.asp
>
> This answers the behavior of your #2,
>
> For your #1, if you add the user control before the OnPreRender event,
your
> event handling should be well, but there is also something different from
> staticly added control.(Such as viewstate restoration etc) If you add your
> usercontrol in Init method, then it will appear as the staticly added
> control, please refer to:
> "HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET"
> http://support.microsoft.com/...
>
> Actually, for your #1, I am not fully understand of "the main content".
Can
> you explain it more detailed for me, so that I can help you better?
> I think if you follow the steps of the upper KB article, everything will
> appear well.
>
> =================================================================
> Please apply my suggestion above and let me know if it helps resolve your
> problem.
>
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
> Have a nice day!!
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>


1 Answer

v-jetan

2/9/2004 5:26:00 AM

0


Hi Joe,

Thanks very much for your feedback.

I am glad my reply makes sense to you. If you have further concern, please
feel free to post, I will help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.