The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.
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 |
The Data Grid allows users to add, edit, and remove data rows.
- 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.
- Handle the following events to post changes to an underlying data source:
- RowInserting/RowInsertingAsync — Fires when a user adds a new row.
- RowUpdating/RowUpdatingAsync — Fires when a user updates a data row.
- RowRemoving/RowRemovingAsync — Fires when a user deletes a data row.
- Handle the InitNewRow event to initialize new data rows.
- 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.
- DataGridEditMode.EditForm (Default) — The Data Grid displays the edit form instead of the edited row.
- DataGridEditMode.PopupEditForm — The Data Grid displays the edit form in a pop-up window.
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.
The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.
Company Name
|
Contact Name
|
Contact Title
|
Phone
|
Country
|
City
|
|
---|---|---|---|---|---|---|
Exotic Liquids | Charlotte Cooper | Purchasing Manager | (171) 555-2222 | UK | London | |
New Orleans Cajun Delights | Shelley Burke | Order Administrator | (100) 555-4822 | USA | New Orleans | |
Grandma Kelly's Homestead | Regina Murphy | Sales Representative | (313) 555-5735 | USA | Ann Arbor | |
Tokyo Traders | Yoshi Nagase | Marketing Manager | (03) 3555-5011 | Japan | Tokyo | |
Cooperativa de Quesos 'Las Cabras' | Antonio del Valle Saavedra | Export Administrator | (98) 598 76 54 | Spain | Oviedo | |
Mayumi's | Mayumi Ohno | Marketing Representative | (06) 431-7877 | Japan | Osaka | |
Pavlova, Ltd. | Ian Devling | Marketing Manager | (03) 444-2343 | Australia | Melbourne | |
Specialty Biscuits, Ltd. | Peter Wilson | Sales Representative | (161) 555-4448 | UK | Manchester |
This module illustrates cascade comboboxes: City and Country. 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 Country combobox.
Both the Country 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 Country and City comboboxes communicate using the OnChanged and GetEditorValue methods to pass/get values to/from each other.