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
|
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;
} |
Hi, I used method, I want to SetCellValue too, how can i Set Value of a SfDatagrid
? After GridViewTableData.view.Refresh i am getting Error
Rohan Singh,
We have checked your requirement, you can set the cell value by SetValue, Please refer the below code snippet for more reference.
Code snippet:
dataGrid.CurrentCellActivated += DataGrid_CurrentCellActivated; private void DataGrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs e) { string newitem = "NewValue"; var rowData = dataGrid.GetRecordAtRowIndex(e.CurrentRowColumnIndex.RowIndex); var itemProperties = rowData.GetType().GetTypeInfo().DeclaredProperties; var column = dataGrid.Columns[e.CurrentRowColumnIndex.ColumnIndex]; string mappingName = column.MappingName; var pDesc = itemProperties.FirstOrDefault(p => p.Name == mappingName); if (pDesc != null) pDesc.SetValue(rowData,newitem); } |
UG Link:https://help.syncfusion.com/xamarin-android/sfdatagrid/editing#currentcellbeginedit
Please let us know if you have any concerns
Regards,
Suthi Yuvaraj.