I am binding the GridDropDownColumn (GDDC) in the ItemDataBound Event and it is working perfect. The problem is that when the grid is in display mode ony (NOT in EDIT nor in INSERT) I cannot see any values in this column. The reason is ofcourse that I am binding the GDDC in edit mode only as specified in the code below. Please see that I am not using DataSourceID in the GDDC markup. I need to bind it through code.
Any help would be appreciated.
Ali
Any help would be appreciated.
Ali
protected void RadGrid1_ItemDataBound(Object source, GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
//first reference the edited grid item |
GridEditableItem editedItem = e.Item as GridEditableItem; |
GridEditManager editMan = editedItem.EditManager; |
//reference the column editor which holds the dropdown list instance in the edit form |
GridDropDownColumnEditor editor = editMan.GetColumnEditor("SectionID") as GridDropDownColumnEditor; |
string selectedValue = editor.SelectedValue; |
// change the data source for ContactTitle with custom code here |
editor.DataSource = mySectionController.getAllModuleSections(); |
editor.DataBind(); |
editor.SelectedValue = selectedValue; |
} |
} |
<telerik:GridDropDownColumn DataField="SectionID" HeaderText="SectionID" |
UniqueName="SectionID" ListTextField="SectionName" ListValueField="SectionID"> |
</telerik:GridDropDownColumn> |