Losing Postback state with composite controls

I

Ian

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top