i tried to use a technique that works fine for GridMaskedColumn and
GridNumericColumn but it does not work for GridDropDownColumn to set the
focus to a particular row of the grid when it's displayed in edit mode
here's my column
and here's my code
here's my column
<telerik:GridDropDownColumn DataField="id" DataSourceID="MyObjectDataSource" |
HeaderText="Name" ListTextField="name" ListValueField="id" DataType="System.Guid" |
UniqueName="id"> |
</telerik:GridDropDownColumn> |
and here's my code
Entity insertedRecordToSetFocusTo = null; |
protected void MyRadGrid_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
// focus |
if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) |
{ |
GridEditableItem item = (GridEditableItem)e.Item; |
if (insertedRecordToSetFocusTo != null) |
{ |
// check if we are at the row to set focus to |
if (item.GetDataKeyValue("id2").ToString() == insertedRecordToSetFocusTo.id2.ToString()) |
{ |
RadComboBox c = (RadComboBox)item["id"].Controls[0]; |
c.Focus(); |
insertedRecordToSetFocusTo = null; |
} |
} |
} |
} |