Append a comma to the end

1 posts, 0 answers
  1. Csaba Gyozo
    Csaba Gyozo avatar
    4 posts
    Member since:
    Mar 2016

    Posted 21 Apr 2017 Link to this post

    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)))
                itm.Checked = true;
                sb.AppendFormat("{0}, ", itm.Text.Trim());
        if (sb.Length > 0)
            combobox.Text = sb.ToString();
Back to Top