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

RadComboBox Check All on Databind

1 Answer 432 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ronald
Top achievements
Rank 1
Ronald asked on 23 May 2017, 03:17 PM

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?

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 26 May 2017, 07:38 AM
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.
Tags
ComboBox
Asked by
Ronald
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or