Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Losing Postback state with composite controls

Thread Tools

Losing Postback state with composite controls

Posts: n/a
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.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing state on bound controls in user controls Josh ASP .Net 1 03-23-2005 03:23 PM
Composite vs non composite Controls Mike ASP .Net Web Controls 4 03-11-2005 05:47 AM
Losing Composite Control property that another Composite Control ... Chad ASP .Net Building Controls 0 02-01-2005 09:01 PM
Losing Session State on a State Server Vinay Joseph Mathew ASP .Net 3 09-16-2004 05:09 PM
Composite control with dynamic composite controls sleigh ASP .Net 1 02-12-2004 06:24 PM