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.
Unfortunately, activation email could not send to your email. Please try again.

How to get value from a cell in sfdatagrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

132979 Oct 2,2017 12:13 PM Oct 3,2017 09:17 AM Xamarin.Android 1
loading
Tags: SfDataGrid
oscar navarro
Asked On October 2, 2017 12:13 PM

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();
        }

https://es.stackoverflow.com/questions/106565/c%C3%B3mo-obtener-los-valores-de-una-celda-o-fila-de-un-sfdatagrid-syncfusion-xamar

Ashok N [Syncfusion]
Replied On October 3, 2017 09:17 AM

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; 
} 
 
Regards, 
Ashok 


CONFIRMATION

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.

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.

;