This is a migrated thread and some comments may be shown as answers.

Winform UI becomes not responding.

3 Answers 482 Views
CheckedDropDownList
This is a migrated thread and some comments may be shown as answers.
Jithin
Top achievements
Rank 1
Jithin asked on 01 Sep 2016, 09:45 AM

Hi,

I am using CheckedDropDownList control in my UI. I have nearly 154 items to be handled with this control. So the UI becomes hanging after selecting and clearing it programmatically. I am using the following codes.

For selection

foreach (var text in dbValues)
    {
        foreach (RadCheckedListDataItem item in this.radCheckedDropDownList1.Items)
        {
            if (item.Text == text)
            {
                item.Checked = true;
            }
        }
    }

For Clearing

radCheckedDropDownList1. CheckedItems.Clear();

if there any convenient way to do this??. Please advice.

 

 

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 01 Sep 2016, 10:57 AM
Hello Jithin,

Thank you for writing.  

In order to check multiple items programmatically, note that it is recommended to use Begin/EndUpdate methods to optimize performance. Thus, the UI will be refreshed at the end but not at each checking the item. You can refer to the attached sample project for your convenience.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Jithin
Top achievements
Rank 1
answered on 02 Sep 2016, 06:22 AM

Hi Dess,

 Thanks for the response. I have already tried the code for clearing the items you have mentioned. But instead of clearing entire items I only want to clear the checked items from the list. When I am doing this it becomes slow and the UI becomes unresponsive. So is there any way to handle it??

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Sep 2016, 01:35 PM
Hello Jithin, 

Thank you for writing back. 

In order to remove the checked items fast, you can use the BeginUpdate/EndUpdate methods as well:
private void radButton2_Click(object sender, EventArgs e)
{
    BindingList<RadCheckedListDataItem> checkedItems = new BindingList<RadCheckedListDataItem>();
    for (int i = 0; i < this.radCheckedDropDownList1.CheckedItems.Count; i++)
    {
        checkedItems.Add(this.radCheckedDropDownList1.CheckedItems[i]);
    }
     
    this.radCheckedDropDownList1.ListElement.BeginUpdate();
    while (checkedItems.Count > 0)
    {
        this.radCheckedDropDownList1.Items.Remove(checkedItems[0]);
        checkedItems.RemoveAt(0);
    }
  
    this.radCheckedDropDownList1.ListElement.EndUpdate();
    this.radCheckedDropDownList1.Text = string.Empty;
}

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
CheckedDropDownList
Asked by
Jithin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Jithin
Top achievements
Rank 1
Share this question
or