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. Advertisements

  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. Advertisements

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:
    1,134
    Purvi T
    Oct 19, 2004
  2. Lars Netzel
    Replies:
    3
    Views:
    596
    Greg Burns
    Jul 22, 2004
  3. =?Utf-8?B?TWlrZQ==?=

    Caching and PageLoad event

    =?Utf-8?B?TWlrZQ==?=, Sep 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    566
    Egbert Nierop \(MVP for IIS\)
    Sep 24, 2004
  4. Robin
    Replies:
    3
    Views:
    706
    Patrick Olurotimi Ige
    Apr 28, 2005
  5. Max2006
    Replies:
    2
    Views:
    1,818
    Walter Wang [MSFT]
    Sep 19, 2007
  6. Kevin Williams

    Custom Control - Event Before PageLoad?

    Kevin Williams, Oct 2, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    167
    Kevin Williams
    Oct 2, 2003
  7. createchildcontrols fires before click event

    , Jun 26, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    307
    Tom John
    Jul 4, 2007
  8. Replies:
    3
    Views:
    1,202
Loading...