How do I clear the contents of a GridDropDownColumn (RadComboBox) which is bound to a EntityDataSource?
The following code changes the data source of a cascading drop-down, but doesn't clear the contents of the RadComboBox - possibly because it's bound to the the EntityDataSource... (I hope to avoid doing a UNION NULL on the EntityDataSource).
Any thoughts?
The following code changes the data source of a cascading drop-down, but doesn't clear the contents of the RadComboBox - possibly because it's bound to the the EntityDataSource... (I hope to avoid doing a UNION NULL on the EntityDataSource).
protected void rgUnits_ItemCreated(object sender, GridItemEventArgs e)
{
GridEditableItem item = e.Item as GridEditableItem;
if (item != null &&
item.IsInEditMode &&
item.OwnerTableView.DataSourceID != DataSourceIDUnitItem) // Parent Row
{
RadComboBox combo = (RadComboBox)item["EquipmentType"].Controls[0];
combo.AllowCustomText = true;
combo.AutoPostBack = true;
combo.SelectedIndexChanged += combo_SelectedIndexChanged;
}
}
void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;
int equipmentTypeID = 0;
if (int.TryParse(((RadComboBox)editedItem["EquipmentType"].Controls[0]).SelectedValue, out equipmentTypeID))
{
EquipmentDescriptionDataSource.Where = string.Format(EquipmentDescriptionFilter, equipmentTypeID);
RadComboBox rcbEquipmentDescription = ((RadComboBox)editedItem["EquipmentDescription"].Controls[0]);
rcbEquipmentDescription.DataBind();
rcbEquipmentDescription.ClearSelection();
rcbEquipmentDescription.Text = string.Empty;
}
}
Any thoughts?