When does a control get its items?

  • Thread starter Thread starter acedev
  • Start date Start date
A

acedev

Hi all,

I have a databound checkedlistbox on my form. In Page_Load I call a
combobox1_selectedindexchanged event - the code in this event loops
through the items in the checkedlistbox setting the CheckState for
particular items.

The only problem is when I raise the selectedindexchanged event in
Page_Load there are no items in the checkedlistbox! The checkedlistbox
returns a count of 0. After the form is visible the checkedlistbox has
items.

I am using C#, and would like to know:

1. When do the items for the checkedlistbox get loaded

and

2. Which event should I use if Page_Load is not suitable?
Thanks for your help

Stuart
 
Whatever the control is bound to must be populated. If it is populated after
it is bound to the control, one of the databinding methods should be invoked.
(control.binddata or something like it).
 
Back
Top