I have a RadGrid with a customized GridDrownColumn, everything based on this http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/customize-griddropdowncolumn The dropdown is working ok, i've had problems cause in gridViewMode the column was empty, however i manage to handle this.
Now the only problem es when the record is in EditMode, the selected value in the combo is always the first element of the list, no matter wich value is selected
protected void GridSCG_ItemDataBound(object sender, GridItemEventArgs e){
if (e.Item is GridDataItem) //This is how i show the value in view mode
{
GridDataItem item = (GridDataItem)e.Item;
SCG_DATOS_ADUANA_238 row = (SCG_DATOS_ADUANA_238)e.Item.DataItem;
item["DTA_TRAFICO"].Text = row.DTA_TRAFICO;
}
if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
GridDropDownListColumnEditor editor = editMan.GetColumnEditor("DTA_TRAFICO") as GridDropDownListColumnEditor;
editor.DataSource = new DropDownListItem[] { new DropDownListItem("I", "I"), new DropDownListItem("E", "E") };
editor.DataTextField = "Text";
editor.DataValueField = "Value";
editor.DataBind();
SCG_DATOS_ADUANA_238 row = (SCG_DATOS_ADUANA_238)editedItem.DataItem;
if (row.DTA_TRAFICO != "")
{
if (row.DTA_TRAFICO == "I")
editor.DropDownListControl.SelectedValue = "I";
else
editor.DropDownListControl.SelectedValue = "E";
}
}
}