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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get value from a cell in sfdatagrid?

Thread ID:





132979 Oct 2,2017 04:13 PM UTC Oct 3,2017 01:17 PM UTC Xamarin.Android 1
Tags: SfDataGrid
oscar navarro
Asked On October 2, 2017 04:13 PM UTC

Y try with this code, but not working, maybe this code is for Xamarin Forms
private void OnGetCellValue(object sender, EventArgs e)
            foreach (var column in dataGrid.Columns)
                if (column.MappingName == "CustomerID")
                    var rowData = dataGrid.GetRecordAtRowIndex(2);
                    cellValue = dataGrid.GetCellValue(rowData, column.MappingName) as String;
            string value = cellValue.ToString();


Ashok N [Syncfusion]
Replied On October 3, 2017 01:17 PM UTC

Hi Customer,  
Thanks for contacting Syncfusion support. 
We have checked your code snippet and you are trying to convert object to string (SfDataGrid.GetCellValue method returns object) using as so values not convert to string. You can achieve your requirement by converting the value using ToString method, please refer the below code example: 
private void OnGetCellValue(object sender, EventArgs e) 
    string cellValue = null; 
    foreach (var column in sfGrid.Columns) 
        if (column.MappingName == "CustomerID") 
            var rowData = sfGrid.GetRecordAtRowIndex(2); 
            cellValue = sfGrid.GetCellValue(rowData, column.MappingName).ToString(); 
    string value = cellValue; 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon