RadComboBox Check All on Databind

2 posts, 0 answers
  1. Ronald
    Ronald avatar
    1 posts
    Member since:
    Apr 2017

    Posted 23 May 2017 Link to this post

    I have a RadComboBox with miltiselect checkboxes.

    <telerik:RadComboBox ID="rcbCAMs" runat="server" AppendDataBoundItems="true" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Skin="WebBlue"                      Width="200px" OnSelectedIndexChanged="rcbCAMs_SelectedIndexChanged" AutoPostBack="true" ></telerik:RadComboBox>

    I'm binding the RadComboBox with a databind in C#

    protected void BindToDataTableCAMs(RadComboBox combo)
            {
                CAPData dataSet = new CAPData();
                DataTable dtCAMs = new DataTable();
                dtCAMs = dataSet.GetProjectCAMs(tbProjects.Text);
      
                if (dtCAMs.Rows.Count != 0)
                {
                    combo.DataTextField = "Manager";
                    combo.DataValueField = "Manager";
                    combo.DataSource = dtCAMs;
                }
      
                combo.DataBind();
            }   

     

    How do I set the default to be Check All on the initial load?

     

  2. Eyup
    Admin
    Eyup avatar
    4046 posts

    Posted 26 May 2017 Link to this post

    Hi Ronald,

    You can achieve this requirement using the following approach:
    RadComboBox1.DataBind();
    foreach (RadComboBoxItem item in RadComboBox1.Items)
    {
        item.Checked = true;
    }

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top