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.
Syncfusion Feedback

How to set default values for columns in AddNewRow?

AddNewRow allows you to add rows in the runtime to enter new records in the DataGrid control. By default, SfDataGrid does not set any default value for columns in the AddNewRow. However, the SfDataGrid allows you to set some initial values for AddNewRow by clicking in the AddNewRow and handling the AddNewRowInitiating event that is triggered when you start editing in AddNewRow. By handling this event, you can add custom values for the AddNewRow columns in the DataGrid.

The following code example demonstrates how to add initial values to AddNewRow by handling the AddNewRowInitiating event.

C#

 

Event

Parameters

Description

AddNewRowIntiating

NewObject

This event is triggered when you start editing in the AddNewRow.

NewObject – This contains the newly created object that helps set the default value when you start editing in the AddNewRow.

Note: NewObject is read-only property.

The following screenshot shows the output of the above code. The AddNewRow is initiated with some default values.

D:\Syncfusion\Issues\2014 Volume 2\KB Issues\KB Images\AddNewRowInitiating.png

 

Sample Links:

WPF

WRT

SilverLight

UWP

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
2501 08/13/2014 01/25/2016 WPF SfDataGrid 4.5
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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