DoubleClick row to open data in new Form

Hello,

I need to double click in a SfDataGrid and load data in new Form.
But, I need to get RecordID value from CurrentRow, Column 1.

In Windows datagrid, it's easy:

edit.id.Text = datagrid.CurrentRow.Cells[0].Value.ToString();

But in SfDataGrid, I can't get these value.

In my SfDataGrid, the RecordID is allways the first column in DataGrid.

How can I manage this?

Thanks

1 Reply

MA Mohanram Anbukkarasu Syncfusion Team July 30, 2018 12:21 PM UTC

Hi Carlos, 
  
Thanks for contacting Syncfusion support. 
  
You can get the value of a particular column from the current row by using the SfDataGrid.View.Records collection. Please refer to the below code example and sample from the given location. 
  
Code example: 
this.sfDataGrid.TableControl.DoubleClick += TableControl_DoubleClick; 
  
void TableControl_DoubleClick(object sender, System.EventArgs e) 
{ 
    var rowIndex = DataGridIndexResolver.ResolveToRecordIndex(this.sfDataGrid.TableControl, this.sfDataGrid.CurrentCell.RowIndex); 
    if (rowIndex != -1) 
    { 
        var record = (this.sfDataGrid.View.Records[rowIndex].Data as OrderInfo); 
        MessageBox.Show(record.OrderID.ToString()); 
    } 
} 
  
  
Regards, 
Mohanram A. 


Loader.
Up arrow icon