When does a control get its items?

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
 
G

Guest

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).
 

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

Top