<
telerik:RadGrid
ID="referencesForCaseGrid"
Skin="MainGrid"
EnableEmbeddedSkins="false"
ShowStatusBar="false"
runat="server"
AutoGenerateColumns="False"
AllowSorting="True"
AllowMultiRowSelection="False"
GridLines="None"
Style="border: 0; outline: none;"
HeaderStyle-Height="25"
AllowAutomaticInserts="false"
AllowAutomaticDeletes="false"
AllowAutomaticUpdates="false"
EnableViewState="false">
<ItemStyle Wrap="true" VerticalAlign="Top" />
<AlternatingItemStyle Wrap="true" VerticalAlign="Top" />
<ClientSettings>
<Selecting AllowRowSelect="false" />
<Scrolling AllowScroll="false" />
</ClientSettings>
<MasterTableView
AllowPaging="true"
PageSize="10"
PagerStyle-AlwaysVisible="true"
AllowMultiColumnSorting="True"
EnableColumnsViewState="false"
AllowCustomSorting="false"
TableLayout="Fixed"
EditMode="InPlace">
<Columns>
<telerik:GridDropDownColumn
UniqueName="RelationStatus"
HeaderText="Relation Status"
DataField="RelationStatusTypeID"
ListDataMember="RelationStatusTypes"
ListTextField="Title"
ListValueField="ID"
SortExpression="Title"
DropDownControlType="RadComboBox"
HeaderStyle-Width="150px" />
<telerik:GridEditCommandColumn />
</Columns>
</MasterTableView>
</telerik:RadGrid>
So when i press edit, I can choose a value in the dropdown, press update and the update command -event fires.
void
caseGrid_UpdateCommand(object source, GridCommandEventArgs e)
{
if(e.CommandName.Equals("Update") && e.Item is GridEditableItem)
{
var item = e.Item as GridDataItem;
int oldRelationTypeID = int.Parse(item.GetDataKeyValue("RelationStatusTypeID").ToString());
RadComboBox ddl = item["RelationStatus"].Controls[0] as RadComboBox;
int newRelationTypeID = int.Parse(ddl.SelectedValue);
GridEditableItem item2 = e.Item as GridEditableItem;
GridEditManager man = item2.EditManager;
RadComboBox operCombo = (man.GetColumnEditor("RelationStatus") as GridDropDownListColumnEditor).ComboBoxControl;
string operId = operCombo.SelectedValue;
// also returns preselected value
}
}
The problem here is that the value I get is the preselected one, not the one selected in the dropdown.