Edit Modes

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

The Data Grid allows users to add, edit, and remove data rows.

  1. Add DxDataGridCommandColumn to the Data Grid. This column displays the New, Edit, and Delete command buttons. To hide unnecessary buttons, use the NewButtonVisible, EditButtonVisible, and DeleteButtonVisible properties.
  2. Handle the following events to post changes to an underlying data source:
  3. Handle the InitNewRow event to initialize new data rows.
  4. Specify the key data field to enable the Data Grid to identify individual data items.

The Data Grid supports different edit modes. Use the Edit Mode option above (corresponds to the EditMode property) to switch between available modes.

When a user clicks New or Edit, the Data Grid displays the Edit Form. This form consists of data editors for each visible column. The editor type depends on the corresponding column's type.

Cascading Editors

Europe, Middle East, Africa London Support Engineer
Asia/Pacific Tokyo System Administrator
North America New York Software Developer

This module illustrates cascade comboboxes: City and Region. These comboboxes are displayed when you edit a grid row. The City combobox is dynamically populated with city names based on the value selected in the Region combobox.

Both the Region and City columns use the EditTemplate context cast to the CellEditContext type that contains:

  • An original cell value as a DataItem object.
  • An EditedValues dictionary with changed cell values.
  • A CellValue object that stores the current cell’s value.
  • Two overloads of the OnChanged method that allow one combobox to respond to another combobox’s value change.
  • The GetEditorValue method that returns a value of any grid cell.

Click Edit to see how the Region and City comboboxes communicate using the OnChanged and GetEditorValue methods to pass/get values to/from each other.