views:

116

answers:

1

Hi,

I have a user control in an UpdatePanel. The user control has CheckBoxList, and can be dynamically created or deleted by UI action.

In most cases it works fine. The problem occurs when:

  1. The parent page is loaded with one such user control pre-populated, say, with checkbox 'A' checked and checkbox 'B' unchecked.
  2. The user control is deleted by UI action. In other words, a PlaceHolder.Remove() call is made.
  3. The user control is re-added and checkbox 'B' is checked, both by UI action. Checkbox 'A' is unchecked as expected, since this is a fresh instance of the user control.
  4. A button to submit and process UI data is clicked. This button is also inside the UpdatePanel.

During 4., the state of the user control gets wonky. It somehow sees both checkbox 'A' and checkbox 'B' as being checked. I tried manually clearing the CheckBoxList's selections in step 2., but this had no impact. I know the CheckBoxList's selections are incorrectly set between LoadViewState() and OnLoad(), but I'm not sure exactly when or how.

Anyone have a read on this?

Thanks,

Calvin

A: 

Anyone? I've learned the CheckBoxList's LoadPostData() seems to be the culprit, but still can't see why.

Calvin Nguyen