The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientGridView.AddNewRow Method

Adds a new record.

Declaration

AddNewRow(): void

Remarks

The AddNewRow method switches the ASPxGridView to edit mode and allows you to add a new row. To add the new record to the underlying datasource, call the ASPxClientGridView.UpdateEdit method. End-users can save the changes made using the Update command.

To initialize row values in code, handle the ASPxGridView.InitNewRow event.

The ASPxGridBase.KeyFieldName property must be specified to enable adding new rows.

Example

<dx:ASPxGridView ClientInstanceName="gv" ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
    <Columns>
        ...
    </Columns>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="ASPxButton">
    <ClientSideEvents Click="function(s, e) {
        gv.AddNewRow();
    }" />
</dx:ASPxButton>
See Also