Control event that fires before PageLoad? Is it possible?

Discussion in 'ASP .Net Web Controls' started by Strife_SD, May 7, 2008.

  1. Strife_SD

    Strife_SD Guest

    Hello,

    I'm trying to develop a custom grid pager control. I would like it so that
    the user clicks the page change button on the control and the page does a
    post back and the server control changes the page number, the page then loads
    the data and binds it to the gird via the PageLoad event. The problem is
    that the grid page change event occurs after the PageLoad, so the correct
    page number is not updated in time for the data call. I've got around the
    problem by moving the data call \ databind of the grid to the PreRender
    event, which occurs after the page change event, but if I turn viewstate off
    on the grid the page change event never fires. I'm assuming this occurs
    because the PreRender is late in the page life cycle and the control can not
    load it's state? The Telerik grid that I'm using requires that the grid
    pager be created dynamically, every time the page is loaded. I'm new to
    custom server controls. Does anyone know how to make it so the control can
    process the data before the pageload fires? Thanks
     
    Strife_SD, May 7, 2008
    #1
    1. Advertising

  2. Hello Strife

    <Control>.OnInit fires before <Page>.OnLoad.
    See: http://www.aspnetzone.de/photos/peterbucher/images/182900/original.aspx

    Otherwise you can make use of <Page>.PreRender

    --
    Gruss, Peter Bucher
    Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
    http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
    "Strife_SD" <> wrote in message
    news:...
    > Hello,
    >
    > I'm trying to develop a custom grid pager control. I would like it so that
    > the user clicks the page change button on the control and the page does a
    > post back and the server control changes the page number, the page then
    > loads
    > the data and binds it to the gird via the PageLoad event. The problem is
    > that the grid page change event occurs after the PageLoad, so the correct
    > page number is not updated in time for the data call. I've got around the
    > problem by moving the data call \ databind of the grid to the PreRender
    > event, which occurs after the page change event, but if I turn viewstate
    > off
    > on the grid the page change event never fires. I'm assuming this occurs
    > because the PreRender is late in the page life cycle and the control can
    > not
    > load it's state? The Telerik grid that I'm using requires that the grid
    > pager be created dynamically, every time the page is loaded. I'm new to
    > custom server controls. Does anyone know how to make it so the control
    > can
    > process the data before the pageload fires? Thanks
     
    Peter Bucher [MVP], May 7, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    864
    Purvi T
    Oct 19, 2004
  2. Lars Netzel
    Replies:
    3
    Views:
    444
    Greg Burns
    Jul 22, 2004
  3. Robin
    Replies:
    3
    Views:
    592
    Patrick Olurotimi Ige
    Apr 28, 2005
  4. Kevin Williams

    Custom Control - Event Before PageLoad?

    Kevin Williams, Oct 2, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    111
    Kevin Williams
    Oct 2, 2003
  5. Replies:
    3
    Views:
    1,002
Loading...

Share This Page