We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Resume a specific value from a row, any cell is pressed

Hi,
how can this "dataGridView1.CurrentRow.Cells["ID"].Value" be converted for GridDataBound  to have the same effect.
Thanks.


1 Reply

AR Arulpriya Ramalingam Syncfusion Team May 30, 2017 12:38 PM UTC

Hi Nino, 

Thanks for using Syncfusion products. 

We could able to understand your scenario. In GridDataBoundGrid, the cell value of a particular cell can be retrieved from current record value using GetRecordStateAtRowIndex and GetValue methods. The GetRecordStateAtRowIndex method can be used to get the current record and GetValue method can be used to get the particular cell value. Please make use of the provided code sample and KB link, 

Code snippet 
 
//Event Subscription 
gridDataBoundGrid1.CurrentCellControlDoubleClick += GridDataBoundGrid1_CurrentCellControlDoubleClick; 
     
//Event Customization 
private void GridDataBoundGrid1_CurrentCellControlDoubleClick(object sender, ControlEventArgs e) 
{ 
    if (gridDataBoundGrid1.CurrentCell.ColIndex == 2) 
    { 
        int rowIndex = gridDataBoundGrid1.CurrentCell.RowIndex; 
        //To get the current record 
        GridBoundRecordState record = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(rowIndex); 
        foreach (GridBoundColumn column in this.gridDataBoundGrid1.Binder.InternalColumns) 
        { 
            if (column.MappingName == "Description") 
            { 
                //To get the particular cell value 
                string value = column.PropertyDescriptor.GetValue(record.Table[record.Position]).ToString(); 
                MessageBox.Show(value); 
            } 
        } 
    } 
} 
 
 

Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon