Hello,
I have a RadGrid, this RadGrid uses an Edit Form Template containing multiple controls for user input. In particular, I am interested in how I can add existing values to a RadComboBox which has multiple checkbox options when the edit form is opened.
Currently, I have methods to get all the values I need to check from my database. I also have all other elements in the grid initialized on edit mode because they are bound in my markup. Below is the code I am trying to use to check some items in the RadComboBox (OnEditOrInsertMode handles RadGrid.OnItemCreated, getFormFactorIds is a function that returns a list of ids to be checked.):
But, this seems to have no effect when I verify that a particular item has values marked in the multiple select combobox, and step through the code in the debugger and watch the 'Checked' values be set to 'true'.
What is causing the 'Checked' values to be set back to false?
Am I setting the 'Checked' values in the correct handler?
Thanks
I have a RadGrid, this RadGrid uses an Edit Form Template containing multiple controls for user input. In particular, I am interested in how I can add existing values to a RadComboBox which has multiple checkbox options when the edit form is opened.
Currently, I have methods to get all the values I need to check from my database. I also have all other elements in the grid initialized on edit mode because they are bound in my markup. Below is the code I am trying to use to check some items in the RadComboBox (OnEditOrInsertMode handles RadGrid.OnItemCreated, getFormFactorIds is a function that returns a list of ids to be checked.):
01.
protected void OnEditOrInsertMode(object sender, GridItemEventArgs e)
02.
{
03.
// Initalizes the RadComboBoxFormFactor combobox like all the other controls in the form.
04.
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
05.
{
06.
GridEditableItem item = (GridEditableItem) e.Item;
07.
RadComboBox formFactorComboBox = (RadComboBox) e.Item.FindControl("RadComboBoxFormFactor");
08.
List<
int
> formFactorIds = (List<
int
>) getFormFactorIds((int) ((GridEditableItem)e.Item).GetDataKeyValue("CID"));
09.
10.
formFactorComboBox.DataBind();
11.
foreach (RadComboBoxItem rcbItem in formFactorComboBox.Items)
12.
{
13.
rcbItem.Checked = formFactorIds.Contains(int.Parse(rcbItem.Value));
14.
}
15.
formFactorComboBox.DataBind();
16.
}
17.
}
But, this seems to have no effect when I verify that a particular item has values marked in the multiple select combobox, and step through the code in the debugger and watch the 'Checked' values be set to 'true'.
What is causing the 'Checked' values to be set back to false?
Am I setting the 'Checked' values in the correct handler?
Thanks