RegisterRequiresPostback failing to call LoadPostData

Discussion in 'ASP .Net' started by John Burke, Apr 23, 2004.

  1. John Burke

    John Burke Guest

    I am getting a curious problem where LoadPostData is not being called after
    registering the control using RegisterRequiresPostback. Other controls not
    requiring postback registration are having LoadPostData called. Each
    control calling RegisterRequiresPostback does have a uniqueid and exists for
    the lifetime of the page, so it's not a mis-referencing problem.

    It's worth noting that this was working fine until I killed the Viewstate
    and emitted an empty Viewstate hidden field instead. Is it possible that
    somewhere in the inner workings of the page class there is some dependency
    between RegisterRequiresPostback and the Viewstate?

    Any clues?

    JB
     
    John Burke, Apr 23, 2004
    #1
    1. Advertising

  2. John Burke

    Teemu Keiski Guest

    Hi,

    there is dependency such way that Page class checks existence of VIEWSTATE
    and EVENTTARGET form elements at the beginnig of request to detect the
    postback mode (it returns the request data collection based on this). If
    both __VIEWSTATE and __EVENTTARGET hidden form elements are missing
    completely, request collection is null.This same collection is the one that
    is passed to the LoadPostData method (still LoadPostData should be called in
    any case). But I suppose you have removed only the __VIEWSTATE hidden field,
    so it can't be the problem.

    Can you tell/post some code that demonstrates where do you do the
    registration for postback handling?

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke



    "John Burke" <> wrote in message
    news:...
    I am getting a curious problem where LoadPostData is not being called after
    registering the control using RegisterRequiresPostback. Other controls not
    requiring postback registration are having LoadPostData called. Each
    control calling RegisterRequiresPostback does have a uniqueid and exists for
    the lifetime of the page, so it's not a mis-referencing problem.

    It's worth noting that this was working fine until I killed the Viewstate
    and emitted an empty Viewstate hidden field instead. Is it possible that
    somewhere in the inner workings of the page class there is some dependency
    between RegisterRequiresPostback and the Viewstate?

    Any clues?

    JB
     
    Teemu Keiski, Apr 24, 2004
    #2
    1. Advertising

  3. John Burke

    Sam Guest

    Is it possible that somehow the Viewstate is carrying the ID of the
    malfunctioning control? If it wasn't restored before LoadPostData
    then of course that event wouldn't fire.

    Make sure the ID of the control is being set in Init (either
    explicitly or because you add it the the Controls collection) and
    doesn't change during the lifecycle. But I assume you've already
    tried these simple tests... Once though I had a similiar problem
    because I added the control in Init and explicity set its ID in Page
    Load, thus inadvertantly skipping the 1st ProcessPostData stage.

    -Sam

    "John Burke" <> wrote in message news:<>...
    > I am getting a curious problem where LoadPostData is not being called after
    > registering the control using RegisterRequiresPostback. Other controls not
    > requiring postback registration are having LoadPostData called. Each
    > control calling RegisterRequiresPostback does have a uniqueid and exists for
    > the lifetime of the page, so it's not a mis-referencing problem.
    >
    > It's worth noting that this was working fine until I killed the Viewstate
    > and emitted an empty Viewstate hidden field instead. Is it possible that
    > somewhere in the inner workings of the page class there is some dependency
    > between RegisterRequiresPostback and the Viewstate?
    >
    > Any clues?
    >
    > JB
     
    Sam, Apr 26, 2004
    #3
    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. William F. Robertson, Jr.

    LoadPostData

    William F. Robertson, Jr., Jul 22, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    521
    William F. Robertson, Jr.
    Jul 24, 2003
  2. Lucas Tam

    LoadPostData and LinkButtons

    Lucas Tam, Aug 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    324
    Lucas Tam
    Aug 18, 2003
  3. Sam
    Replies:
    2
    Views:
    4,489
  4. Sam
    Replies:
    2
    Views:
    3,069
    camelinckx
    Mar 24, 2008
  5. Cathead

    RegisterRequiresPostBack and child custom controls

    Cathead, Oct 1, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    206
    Cathead
    Oct 1, 2003
Loading...

Share This Page