Losing Postback state with composite controls

Discussion in 'ASP .Net Building Controls' started by Ian, Jun 9, 2005.

  1. Ian

    Ian Guest

    Not sure how to go about explaining this, which is never a good sign.

    I have a Custom UserControl I've built, which contains 1 drop-down list
    and 5 labels. This control gets loaded into a page which has about 40
    other controls.

    On the SelectedIndexChanged for the control's drop-down list, I save
    the selected value of the drop-down in one of the 5 labels (long
    story), and then re-bind the values of the labels based on the new
    value that the user has picked from the DDL. (ie, if user selected
    entity X from the drop-down list, I rebind the various datalabels based
    on that choice).

    This all works fine. I have an empty Page_Load event which has no body.
    The The page which contains the control does not re-setup the control
    on a Postback event, so ViewState is handling everything. I can select
    and re-select the drop-down multiple times, each time the postbacks are
    working fine, and all the values are remaining intact.

    My problem is when the Page, which contains this control (along with
    the 40 others), Postbacks on a Button click event. Somewhere in between
    the control's page_load event( in which I've set breakpoints to verify
    that the label exists and has a value), and when I ask for its label
    value through a return method I've written, the label becomes:

    "Object reference not set to an instance of an object."

    So, I am hoping to get some help on what events I might want to probe
    into to figure out what's going on here. What's even more bothersome is
    that this same control is being used on another page, very simliar in
    layout to this one, and has seemingly no problems, once I changed the
    autoeventwireup to true.

    Any tips or ideas on the best approach to debugging this? I'm tearing
    out what's left of my remaining hair.


    ian
     
    Ian, Jun 9, 2005
    #1
    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. sleigh
    Replies:
    1
    Views:
    2,738
    sleigh
    Feb 12, 2004
  2. Vinay Joseph Mathew

    Losing Session State on a State Server

    Vinay Joseph Mathew, Aug 10, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    624
    =?Utf-8?B?c29ubnk=?=
    Sep 16, 2004
  3. Josh
    Replies:
    1
    Views:
    554
    ashish
    Mar 23, 2005
  4. Chad
    Replies:
    0
    Views:
    254
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    292
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page