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

How to update the cell content on AddNewRecord in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl
Tags: addnewrow, update

Update cell content on AddNewRecord

In order to update a computed value in the WinForms Grid Control part which is being added, it can be done using the QueryCellStyleInfo event. In this article, the cell value of a record is being updated in another cell value depending upon the value specified.


// Form()
// Hook the required event.
this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
// Specify the criteria for updating.
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
    double temp = 0.0;
    GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
    if (e.TableCellIdentity.TableCellType == GridTableCellType.AddNewRecordFieldCell && e.TableCellIdentity.Column.Name == "SampleData")
        Element el = e.TableCellIdentity.DisplayElement;
        Record r = el.GetRecord();
        object ACol = r.GetValue("CategoryName");
        //The cellvalue to be computed and updated value.
        if (r != null && ACol != null && (double.TryParse(ACol.ToString(), out temp)))
            object ob = (temp * 0.4).ToString();
            e.Style.CellValue = ob.ToString();


' Form()
' Hook the required event.
AddHandler gridGroupingControl1.QueryCellStyleInfo, AddressOf gridGroupingControl1_QueryCellStyleInfo
' Specify the criteria for updating.
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
   Dim temp As Double = 0.0
   Dim cc As GridCurrentCell = Me.gridGroupingControl1.TableControl.CurrentCell
   If e.TableCellIdentity.TableCellType = GridTableCellType.AddNewRecordFieldCell AndAlso e.TableCellIdentity.Column.Name = "SampleData" Then
     Dim el As Element = e.TableCellIdentity.DisplayElement
     Dim r As Record = el.GetRecord()
     Dim ACol As Object = r.GetValue("CategoryName")
     'The cellvalue to be computed and updated value.
     If r IsNot Nothing AndAlso ACol IsNot Nothing AndAlso (Double.TryParse(ACol.ToString(), temp)) Then
       Dim ob As Object = (temp * 0.4).ToString()
       e.Style.CellValue = ob.ToString()
     End If
   End If
End Sub


New value is being added in the cell value of the record.

Show the computed value in the column cell value in WinForms Grid Control

The computed value is updated in the cell value of the column “SampleData” simultaneously.

Show the updated value to AddNewRecord in WinForms Grid Control


C#: UpdatingAddNewRecord_CS

VB: UpdatingAddNewRecord_VB


I hope you enjoyed learning about how to update the cell content on AddNewRecord in WinForms GridGroupingControl.

You can refer to our WinForms Grid Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Grid Control documentation to understand how to present and manipulate data. 

For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Grid Control and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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