Hello Everyone,
First of all thanking for the great support from the Telerik team.
I have a problem with RadGrid when I'm using it with GridDropDownColumn.
My scenario:
I have a grid with GridDropDownColumn column. I load the values of the ComboBox during ItemDataBound event and and select the values from it if I'm in edit mode. In this situation I don't see the text of this column in the grid table.
So I added in the ItemDataBound event a check if the item is GridDataItem and then set the GridDataItem.Text to the right value (The text should be a little bit different from the text used in the ComboBox). It works OK now and showing the text in the Grid table.
Now I face another problem, I have NestedTemplate in this grid. When I expand the column the text of the GridDropDownColumn column disapears... How can I resolve this problem?
My code:
Regards,
Alex.
First of all thanking for the great support from the Telerik team.
I have a problem with RadGrid when I'm using it with GridDropDownColumn.
My scenario:
I have a grid with GridDropDownColumn column. I load the values of the ComboBox during ItemDataBound event and and select the values from it if I'm in edit mode. In this situation I don't see the text of this column in the grid table.
So I added in the ItemDataBound event a check if the item is GridDataItem and then set the GridDataItem.Text to the right value (The text should be a little bit different from the text used in the ComboBox). It works OK now and showing the text in the Grid table.
Now I face another problem, I have NestedTemplate in this grid. When I expand the column the text of the GridDropDownColumn column disapears... How can I resolve this problem?
My code:
protected void AttributesRadGrid_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem editedItem = e.Item as GridEditableItem; GridEditManager editMan = editedItem.EditManager; GridDropDownListColumnEditor fieldTypeEditor = editMan.GetColumnEditor("FieldType") as GridDropDownListColumnEditor; GridDropDownListColumnEditor attributeCategoryIDEditor = editMan.GetColumnEditor("AttributeCategoryID") as GridDropDownListColumnEditor; fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Text", "0")); fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Yes/No", "1")); fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Multi Yes/No", "2")); fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Select", "3")); FillAttributeCategoriesComboBox(attributeCategoryIDEditor.ComboBoxControl); if (e.Item.RowIndex != -1) { CellphonesCL.Database.attributes attr = (CellphonesCL.Database.attributes)e.Item.DataItem; fieldTypeEditor.ComboBoxControl.SelectedValue = attr.FieldType.ToString(); attributeCategoryIDEditor.ComboBoxControl.SelectedValue = attr.AttributeCategoryID.ToString(); } } else if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; CellphonesCL.Database.attributes attr = (CellphonesCL.Database.attributes)e.Item.DataItem; dataItem["AttributeCategoryID"].Text = attr.attributecategories.Title; dataItem["FieldType"].Text = attributes.GetAttributeFieldTypeStr((AttributeFieldType)attr.FieldType); } }Regards,
Alex.
