Changing default CheckedDropDownList behaviour

2 Answers 16 Views
CheckedDropDownList
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Toby asked on 11 Oct 2024, 11:37 AM

Hi,

 

In my application I wantg to give the user the baility to select from multiple items using the checked drop down list box control, in adidtion I want to be able to do the following:

1. prevent the user from typing anything in to the RadCheckedDropDownListEditableAreaElement. i.e. the user can select items via the drop down check list.

2. override the text displayed in RadCheckedDropDownListEditableAreaElement, so that

  • if no items are displayed there is no text
  • if one item is displayed then monly that item is displayed - with no 'X' to remove it
  • if more than one item is selected, then display the single word "Multiple"

How do I go about achieveing this behaviour ?

many thanks

Toby

2 Answers, 1 is accepted

Sort by
0
Accepted
Toby
Top achievements
Rank 3
Iron
Iron
Iron
answered on 11 Oct 2024, 12:06 PM | edited on 11 Oct 2024, 12:07 PM
Ok, the following code fixes my first issue of preventing user input to the text area.
public RadForm1()
{
  InitializeComponent();
  this.radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.AutoCompleteTextBox.KeyPress += AutoCompleteTextBox_KeyPress;
}

private void AutoCompleteTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
  e.Handled = true;
}

0
Toby
Top achievements
Rank 3
Iron
Iron
Iron
answered on 11 Oct 2024, 12:57 PM

And to answer my second issue

I swapped to using RadDropDownButton and then added some RadCheckBoxElements to it with asociated toggle state changed event handler. When this event handler is fired, I simplly count the number of checked items and update the button text accordingly.

Note that adding RadMenuItem and setting CheckOnClick to true, when clicking on teh menu item this causes the popup to close. Using RadCheckBoxElement leaves the pop up open until the user clicks outside the control.

Nadya | Tech Support Engineer
Telerik team
commented on 14 Oct 2024, 02:10 PM

Hello, Toby,

Reading your latest comments, it seems to me that you have found working solutions to both of your issues. Am I right? Do you still need any help with something?

Please let me know if I can assist you further.

Tags
CheckedDropDownList
Asked by
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or