OnLoadComplete and custom server control

Last post 10-20-2006 5:58 AM by dmcweeney. 2 replies.

Sort Posts:

  • OnLoadComplete and custom server control

    10-19-2006, 10:51 AM
    • Member
      45 point Member
    • dmcweeney
    • Member since 06-21-2006, 9:50 AM
    • Posts 13

    Hi,

    I've hooked the pages OnLoadCOmplete event to fire for a custom control, however when the code fires the control's page property in null? Any ideas why this would be.

    My control's OnInit looks as follows:

    if ( this.Page != null )
    {
    this.Page.LoadComplete += new EventHandler( this.LoadCompleteEventHandler );
    }

    The handler is as follows:

    private void LoadCompleteEventHandler( object sender, EventArgs e )
    {
    this.Page.Trace.Write( "XXX", "OnLoadComplete" );
    }

    However the trace fails as this.Page is null.

    Thanks

    Donal 

     

  • Re: OnLoadComplete and custom server control

    10-20-2006, 5:51 AM
    I have tried your code.If you add this.Page.LoadComplete event handler in Page_Load,it will trigger normally and the page has the value "ASP.Default.aspx". 
  • Re: OnLoadComplete and custom server control

    10-20-2006, 5:58 AM
    • Member
      45 point Member
    • dmcweeney
    • Member since 06-21-2006, 9:50 AM
    • Posts 13

    Hi Jasson,

    Thanks for the quick response.

    I'm not writing the Page code so dont have access to that. What I am trying to do is emulate the OnLoadComplete in a custom server control.

    Any ideas?

    Thanks

    Donal

Page 1 of 1 (3 items)