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

Checkboxes and Multiple Defaults

0 Answers 37 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 27 Apr 2013, 01:28 PM

I figured out how to set defaults for the multiple check boxes.

Here is my example:

DataTable tableMonths = new DataTable();
tableMonths.Columns.Add("name", typeof(int));
tableMonths.Columns.Add("value", typeof(string));
tableMonths.Rows.Add(12, "12");
tableMonths.Rows.Add(24, "24");
tableMonths.Rows.Add(36, "36");
tableMonths.Rows.Add(48, "48");
tableMonths.Rows.Add(60, "60");
tableMonths.Rows.Add(72, "72");
RadComboBoxMonths.DataSource = tableMonths;
RadComboBoxMonths.DataTextField = "name";
RadComboBoxMonths.DataValueField = "value";
RadComboBoxMonths.DataBind();
// preselect these terms by default
RadComboBoxMonths.SelectedValue = "12";
RadComboBoxItem twelveMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;
twelveMonths.Checked = true;
RadComboBoxMonths.SelectedValue = "24";
RadComboBoxItem twentyFourMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;
twentyFourMonths.Checked = true;
RadComboBoxMonths.SelectedValue = "36";
RadComboBoxItem thritySixMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;
thritySixMonths.Checked = true;

No answers yet. Maybe you can help?

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