Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Show All Themes

Cascading Editors

Customer Name 
EditMaria AndersFaroe IslandsTorshavn
EditThomas HardyAustriaEisenstadt
EditYang WangBermudaHamilton
EditSven OttliebUzbekistanMarghilon
EditJanine LabruneVietnamHanoi
EditMartine RanceHoly SeeVatican City
EditMaria LarssonVirgin IslandsCharlotte Amalie
EditPeter FrankenYemenAden
EditCarlos HernandezAmerican SamoaPago Pago
Page 1 of 2 (14 items)Prev12Next

In this demo, the combo box in the City column (the City combo box) is populated dynamically with city names via callbacks, based on the value selected in the combo box in the Country column (the Country combo box). Only the content stored in the City combo box is updated during round-trips to the server - not the content of the entire view or the DevExpress ASP.NET MVC GridView extension.

To make the City combo box work through callbacks, its settings.CallbackRouteValues property is defined. The property points to a proper Controller ("Editing") and Action ("GetCities") that will handle editor callbacks. In addition, the property defines the TextField text constant whose "CityName" value is passed to the specified Controller Action as a parameter. This parameter identifies a grid column containing the processed City combo box.

The client-side BeginCallback event of the City combo box is handled to identify a country currently selected in the Country combo box. The country identifier is passed to the Controller Action ("GetCities") specified in the CallbackRouteValues property to filter cities by the country.

The Country combo box' client-side SelectedIndexChanged event is handled to initiate a callback to update the City combo box.

On the server side, call the GridViewExtension.GetComboBoxCallbackResult method in the Controller Action ("GetCitiesBatchEdit") to return the result in JSON format for the "City" combobox.

Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxGridViewDemos