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

get value

Hi to all, 
How can I get a value of specific row, specific column?


1 Reply

DS Divakar Subramaniam Syncfusion Team October 7, 2016 04:56 AM UTC

Hi Miguel, 
 
 
Thanks for contacting Syncfusion Support. 
 
 
In SfDataGrid, it is possible to get the value of specific row and specific column using SfDataGrid.GetCellValue(RowData,ColumnName) method by passing row data and column name as parameters. Please refer the below code snippet to know how to get the cell value of each rows and columns. 
 
foreach (var row in sfGrid.View.Records) 
{ 
    foreach (var column in sfGrid.Columns) 
    { 
        //Get the cell value of each column 
        var getCellValue = sfGrid.GetCellValue(row.Data, column.MappingName); 
    } 
} 
 
  
 
You can also get the cell value for the specific column and row as follows. 
 
foreach (var column in sfGrid.Columns) 
{ 
    //Get the cell value of specific row and column 
    if (column.MappingName == "OrderID") 
    { 
        var rowData = sfGrid.GetRecordAtRowIndex(2); 
        var getCellValue = sfGrid.GetCellValue(rowData, column.MappingName); 
    } 
} 
 
 
We have prepared the sample based on your query and you can download the same from the below link. 
 
 
 
 
 
Regards, 
Divakar, 
 


Loader.
Live Chat Icon For mobile
Up arrow icon