views:

160

answers:

1

I have a web user control with a dropdownlist inside of it. When the usercontrol's databind event is called, it automatically fires the dropdownlists databind event. In the dropdownlist's ondatabound event handler an 'other' option is appended to the end of the dropdownlist. The usercontrol is loaded multiple times, depending on selection of other controls on the page. When the page loads initially, there are no items in the usercontrol except the 'other' option. Then when I call the user control's databind event the control reloads, with 4 items plus the 'other' option. The text for the first item in the list is the 'other' option's text, not what it should be. I've stepped through the databound event of the dropdownlist and have found that all items are loading correctly. It appears that the dropdownlist's viewstate is the culprit, that the dropdownlist's original item[0] text and value are overwriting the new text and value. The usercontrol's items are correct after databinding. I've tried disabling viewstate on the dropdownlist, but then it wouldn't load at all.

I've tried using

this.ClearChildViewState();

throughout my usercontrol, with no effect.

Should I try to clear the dropdownlist's viewstate? How do I do that?

Any suggestions would be greatly appreciated.

A: 

It's a very complex page with multipl nested usercontrols. It turned out to be a server side error, not a viewstate issue.

tbilly