Edit Forms

 
First Name Last Name Title Title Of Courtesy Birth Date Hire Date
Nancy Davolio Sales Representative Ms. 12/8/1978 5/1/2005
Andrew Fuller Vice President, Sales Dr. 2/19/1965 8/14/1992
Janet Leverling Sales Representative Ms. 8/30/1985 4/1/2002
Margaret Peacock Sales Representative Mrs. 9/19/1973 5/3/1993
Steven Buchanan Sales Manager Mr. 3/4/1955 10/17/1993
Michael Suyama Sales Representative Mr. 7/2/1981 10/17/1999
Robert King Sales Representative Mr. 5/29/1960 1/2/1994
Laura Callahan Inside Sales Coordinator Ms. 1/9/1985 3/5/2004
Anne Dodsworth Sales Representative Ms. 1/27/1980 11/15/2004

To enable data editing using an edit form within the DevExpress Blazor Grid:

  1. Declare a DxGridCommandColumn object in the Columns template. This column displays predefined New, Edit, and Delete command buttons.
  2. Use the EditFormTemplate to define Grid edit form content. You can populate the template with custom editors or call the GetEditor method to get the column editors auto-generated by the Grid. The edit form displays predefined Save and Cancel buttons.
  3. Handle the following events to validate user input and access permissions, and post changes to an underlying data source:
    • EditModelSaving — Fires when a user submits the edit form and validation passes.
    • DataItemDeleting — Fires when a user confirms the delete operation in the delete confirmation dialog. Note that Grid data must be reloaded once you save information to the data source.
  4. If your data object has a primary key, assign it to the KeyFieldName or KeyFieldNames property. The Grid uses field values to compare and identify data items. If you do not specify these properties, the Grid uses standard .NET value equality comparison to identify data items.
  5. (Optional) Handle the CustomizeEditModel event to initialize an edit model for new data rows.

Our Blazor Grid supports different edit modes. In EditForm mode (default), the Grid displays the edit form instead of the edited data row. Check the Use Popup Edit Form option above to switch to the PopupEditForm mode. In this mode, the Grid displays the edit form in a pop-up window.

For detailed information on how to enable data editing and use edit-related options, refer to the following help topic: Edit Data and Validate Input.