Re: RTE Dialogs Fail in .ascx User Control

  •  05-16-2014, 11:06 AM

    Re: RTE Dialogs Fail in .ascx User Control

    What is different about my scenario is that I programmatically insert the user control .ascx into the host .aspx page at runtime, during the Page_Load() event of the host .aspx. Your sample (and successful) usage of an .ascx user control has the .ascx user control declared in the .aspx page markup.

     

    What is important about the difference between the two techniques is this: When you declare the .ascx user control in the .aspx markup (as you do), then when the user control is loaded by the ASP.NET runtime, all of the page request lifecycle events fire for the user control up and to the Page_Load() event of the host page. That is, all the page events (PreInit, Init, InitComplete, PreLoad, and finally Load) fire for the user control. BUT when the user control is programmatically inserted as I do, not all page lifecycle events fire. 

     

    I suspect there is something about RTE dialogs that require/assume one or more of those page event lifecycle to fire in the host page whenever the dialog is opened. But unfortunately when hosted in an ASCX that is programmatically inserted at runtime, those assumptions/requirements are not satisfied.

     

    My scenario is not necessarily unusual in that many content management systems programmatically insert pages that are created at runtime. In these scenarios, there is never an .aspx page in which to declare the .ascx user control. In these scenarios, pages never physically exist and are programmatically created at runtime by a custom HTTP handler.

     

    It would be good if RTE dialogs would function properly in these scenarios. Is it possible RTE already does work in these scenarios, and there is something I am not doing correctly or otherwise failing to do?

     

    - Jeff 

View Complete Thread