Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Santhosh 58 posts 99 karma points
    Apr 25, 2016 @ 05:21
    Santhosh
    0

    ASCX Macro in RTE on a content page DOESN'T trigger PAGE_LOAD event, but triggers PagePreRender

    Hi All,

    I'm using umbraco 6.1.6, and I have a .NET User control as macro and placed inside a rich text editor in a content page.

    For all of my usercontrols, I have a base class(usercontrol) and there I'm handling the errors on any events such as PageLoad, PagePreRender, ... etc

    So on my base user control init, I attach the event for each of the event like Page Load, Page Prerender, and these methods invokes respective overridden page events.

    For Eg.

    *Base User control*

    protected override void OnInit(EventArgs e) {

                base.OnInit(e);
                EcomPageInit(this, e);
                Visible = HasAccessRights;
                Page.InitComplete += PageInitComplete;
                this.Page.Load += new EventHandler(Page_Load);
                if (!Visible) return;
                Page.PreRender += PagePreRender;
                Page.LoadComplete += PageLoadComplete;
                Page.Unload += PageUnload;
                Page.PreLoad += PagePreLoad;
    
        }
    

    protected void Page_Load(object sender, EventArgs e) { //Some common logic for all usercontrols DerivedPageLoad(); }

    protected void PagePreRender(object sender, EventArgs e) { //Some common logic for all usercontrols DerivedPagePreRender(); }

    protected void Page_Load(object sender, EventArgs e) { //Some common logic for all usercontrols }

    protected virtual void DerivedPagePreRender(object sender, EventArgs e) {

        }
    

    protected virtual void DerivedPageLoad(object sender, EventArgs e) {

        }
    

    Usercontrol

    protected override void DerivedPagePreRender(object sender, EventArgs e) { //This is invoked }

    protected override void DerivedPageLoad(object sender, EventArgs e) { //This is NEVER invoked }

    If I have such a setup, Some how the DerivedPageLoad never invoked, but to the surprise DerivedPagePreRender is invoked and executes

    If the derived usercontrol has a such a code (without any overridden method), then it works protected void Page_Load(object sender, EventArgs e) {

       }
    

    Any idea why this happens?

    Thanks Santhosh

Please Sign in or register to post replies

Write your reply to:

Draft