Is there a way to get handle of row of which the selectionvalue is changed in combobox?
Let me try to explain it using example. In GridView, I have two columns, Name, Type
Type column has combobox, with values 1 and 2.
What I want to do is on selecting value 1 in type column , I want to change the Name to "One"
On selecting 2 in type column, I want to change the Name to "Two"
This is what I was trying,
private void OnType_SelectedValueChanged(object sender, EventArgs e)
{
DevExpress.XtraEditors.ComboBoxEdit comboType = sender as DevExpress.XtraEditors.ComboBoxEdit;
DataRow row = (DataRow) myGridView.GetFocusedRow();
if (comboType .SelectedItem.ToString() == "1")
{
row.Name = "one";
}else
{
row.Name = "two";
}
}
But here I am getting myGridView.GetFocusedRow() as null.
What am I doing wrong?
Correct way is to bind a repository editor to column.
RepositoryItemComboBox riCmb = new RepositoryItemComboBox();
Handle the editvaluechanged event
riCmb.EditValueChanged += riCmb_EditValueChanged;
Then inside the event handler
if(myGridView.GetRowCellValue(myGridView.FocusedRowHandle, "FieldName").ToString() == "1")
{
grvInstruments.SetRowCellValue(grvInstruments.FocusedRowHandle, "FieldName", "One");
}