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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Update Table Summary on KeyPress For Newly Added row Using Add new Row Functionality

Thread ID:

Created:

Updated:

Platform:

Replies:

145477 Jun 24,2019 04:25 PM UTC Jun 25,2019 01:43 PM UTC WinForms 1
loading
Tags: SfDataGrid
Avinash
Asked On June 24, 2019 04:25 PM UTC

Following code is added on CurrentCellKeyPress event, Kindly giude me what i am doing wrong ??
private void sfDataGrid_CurrentCellKeyPress(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellKeyPressEventArgs e)
{
if (sfDataGridEntry.CurrentCell.Column.MappingName == "dcBillAmt" && sfDataGridEntry.CurrentCell.Column is GridNumericColumn
&& sfDataGridEntry.CurrentCell.CellRenderer.CurrentCellRendererElement != null)
{
int recordIndex = sfDataGridEntry.TableControl.ResolveToRecordIndex(e.RowIndex);
object rowData = null;
if (sfDataGridEntry.IsAddNewRowIndex(e.RowIndex))
{
rowData = sfDataGridEntry.View.CurrentAddItem;
}
else if (sfDataGridEntry.GroupColumnDescriptions.Count > 0)
{
NodeEntry record = sfDataGridEntry.View.TopLevelGroup.DisplayElements[recordIndex];
if (!record.IsRecords)
{
return;
}

rowData = (record as RecordEntry).Data;
}
else
{
RecordEntry record = sfDataGridEntry.View.Records.GetRecord(recordIndex);
rowData = record.Data;
}
if (rowData != null)
{
ItemPropertiesProvider propertyAccessProvider = sfDataGridEntry.View.GetPropertyAccessProvider();
if (decimal.TryParse(sfDataGridEntry.CurrentCell.CellRenderer.CurrentCellRendererElement.Text, out decimal cellValue))
{
//Update the edited value to the record and refresh the summary.
propertyAccessProvider.SetValue(rowData, sfDataGridEntry.CurrentCell.Column.MappingName, cellValue);
sfDataGridEntry.TableControl.Refresh();
}
}
}
}

Adhikesevan Kothandaraman [Syncfusion]
Replied On June 25, 2019 01:43 PM UTC

Hi Avinash, 

Thanks for using Syncfusion products. 

The summary value will not update while editing on the AddNewRow. It will be calculated only when the new row is added to the underlying collection which is bounded to the DataSource property.    
If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 

Regards, 
Adhi 


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.

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

Live Chat Icon For mobile
Live Chat Icon