Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
UltraComboEditor SelectionChange event is not fired everytime the selection is changed?
posted

Hi,

I am using UltraComboEditor control with the following properties:-

DropDownStype = DropDownList

CheckedListSettings:

      CheckBoxStyle= CheckBox

      EditorValueSource = CheckedItems

      ItemCheckArea = Check

      ListSeparator = ,

I am trying to restrict the user from un-checking all the items so that at least one item in the drop down remains selected. For this I have hooked to SelectionChange event and have written a handler something like this...

if (ultraComboEditor1.SelectedItem.CheckState == CheckState.Unchecked && ultraComboEditor1.CheckItems.Count == 0)

{

    ultraComboEditor1.SelectedItem.CheckState == CheckState.Checked;

}

But I have noticed that SelectionChanged event is not fired everytime we check/uncheck an item in the dropdown list, and hence I am able to enforce the above restriction.

I have also tried SelectionChangeCommitted event, but did not help.

I am not sure if I am missing something here, but it seems like these events are not fired every time a selection is changed.

Is there any other way to have atleast one item selected?

Parents
  • 4940
    Offline posted

    When the value/text of the UltraComboEditor has changed either by a user typing in a value or selecting from the drop down, the ValueChanged event fires.

    Give that event a try instead of the SelectionChanged event. Also, if your check boxes start out as all unchecked, you will need to check if the SelectedItem property is null, and call return to avoid an exception.

Reply Children
No Data