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

Append a comma to the end

0 Answers 61 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Csaba Gyozo
Top achievements
Rank 1
Csaba Gyozo asked on 21 Apr 2017, 01:46 PM

I have several comboboxes with checkboxes. I am setting their checked states from server side. The problem is I also want to append a comma at the end. How do I do that? What I've tried:

 

private void RestoreCheckboxCombobox(RadComboBox combobox, List<int> selectedIds)
{
    List<RadComboBoxItem> selectedItems = new List<RadComboBoxItem>(combobox.Items.Count);
    StringBuilder sb = new StringBuilder(100);
    foreach (RadComboBoxItem itm in combobox.Items)
    {
        if (selectedIds.Contains(int.Parse(itm.Value)))
        {
            selectedItems.Add(itm);
            itm.Checked = true;
            sb.AppendFormat("{0}, ", itm.Text.Trim());
        }
    }
    if (sb.Length > 0)
        combobox.Text = sb.ToString();
}

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Csaba Gyozo
Top achievements
Rank 1
Share this question
or