This example shows how to manually filter a lookup editor's popup data source based on the value of another lookup editor. The solution described is applicable to both standalone and in-place editors.
However, for standalone editors you can use the automatic filtering feature instead, covered in the Cascading Lookups topic. Assume that a Data Grid contains two columns that should allow an end-user to select countries and cities from dropdown lists. When a certain country is selected in the first column, the second column's dropdown list should only provide cities from the selected country. To display the only appropriate values, the second column's values should be filtered based on the first column's value.
This task can be easily implemented if the second column's in-place editor is a look-up editor LookUpEditBase descendant. Handle the ColumnView. ShownEditor event, which fires after an in-place editor has been activated in any grid cell.
Use this event to filter the list of items to be displayed in the look-up editor's dropdown and assign this list to the editor's RepositoryItemLookUpEditBase. DataSource property. General Information WinForms Controls. View this topic on docs. Cascading Lookups. Copyright c Developer Express Inc. All rights reserved.
General Information. WinForms Controls. NET Core Support. What's Installed. Build an Application. Controls and Libraries.This column type is typically used to provide a lookup into some set of relatively static values. Set the DataSource property to the data source that contains possible values to choose from. Set the DisplayMember property to the column of the DataSource that should be displayed in the drop down list. Set the ValueMember property to the column of the DataSource that should be used to update the cell within the grid represented by the FieldName property.
Values will display in the column only if the value in FieldName is within the range of values provided by the ValueMember field values.
However, if you need to perform the sorting according to the DisplayMember instead, you should set the DisplayMemberSort property of the column. GetLookupValue Returns the look-up value for the specified cell value. GetDefaultEditorType Returns the default editor type. GetDefaultEditor Returns the default editor. If you want to set initial values, you should match the GridViewComboBoxColumn to a column which has appropriate values in it. This event is fired when the initialization of an editor is done.
The following example demonstrates a case where the combo box is bound to a column with string values in the data source. In this case the DisplayMember and ValueMember properties are the same, and you need just an array of strings as a data source to the ComboBoxColumn those strings should be equal to the possible values in the data source :.
The example below extends the previous sample, where we bound the combo column to array of strings, by adding a text box column and another combo column, this time bound to a collection of custom object. The first step is to define your grid data source, fill in some data, and set column auto-generation to false so that the grid does not generate its columns from the data source.
The BindingList consists of objects having properties for your value and display members. The "Another ComboBox column" in the grid data source is of type int and our custom object has a property of type int. So in order to link the data source field to our custom object integer field, we have set the ValueMember to "Id".
You have to handle the EditorRequired event. This event is fired every time when an editor needs to be shown. A sample code demonstrating this technique:. All Rights Reserved. See Trademarks for appropriate markings.
UI for WinForms. API Reference. SuppliersBindingSource supplierColumn. Add supplierColumn.
Rows 0. Cells "SupplierColumn". GetLookupValue valueString. Add "Phone", typeof string ; table.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 page or the DevExpress ASP. The client-side SelectedIndexChanged event of the Country combo box is handled to update the City combo box. On the server side, the Callback event is handled to populate the City combo box with required values. Get started today and download your day trial of ASP.
NET Controls and Libraries includes 30 days of free technical support. NET distribution. Refer to the Demos and Sample Applications topic to learn more. DevExpress ASP. NET Subscriptions and are backed by a 60 day unconditional money-back guarantee.
To learn more and obtain pricing information, visit the Compare Features and Pricing webpage. For immediate assistance, contact us by Email at info devexpress. No results found for. All Demos. Sorting and Grouping. Data Summaries. Grid Editing. Cascading Combo Boxes. Data Paging and Scrolling. Version: v vol 2. Change Theme Settings. Themes Loading…. Show All Themes. Drag a column header here to group by that column. Page 1 of 2 14 items 1 2.
Office Base Color. Drag a column header here to group by that column New.The event handler receives an argument of type CellValueChangedEventArgs containing data related to this event. The event does not fire when a cell value changes on a data source level.
The following sample code handles the CellValueChanged event to update the FullName column value after the FirstName column value has been changed. General Information WinForms Controls. XtraWizard ASP. View this topic on docs. Fires immediately after a cell value has been changed. Property Description Column Gets the column that contains the processed cell. RowHandle Gets the handle of the row that contains the processed cell.
Value Gets the current cell value. Copyright c Developer Express Inc. All rights reserved. General Information. WinForms Controls. NET Core Support. What's Installed. Build an Application. Controls and Libraries. Common Features. Get More Help. BaseView Class. BaseViewAppearanceCollection Class. ColumnEventArgs Class. ColumnEventHandler Delegate. ColumnView Class.
ColumnView Members. ColumnView Constructor.
ColumnView Properties. ColumnView Events. AsyncCompleted Event. BeforeLeaveRow Event.
Cascading Combo Boxes
CellValueChanged Event. CellValueChanging Event. ColumnChanged Event.Enables you to customize a particular column's filter dropdown list. Write a handler for this event to manage the items within the list. Existing items can be deleted and new ones added with custom captions and corresponding filter values. For details on customizing the filter dropdown list, see the Filter and Search topic. The text for the items to display in the Filter Panel is retrieved via the custom getFilterDisplayText function.
For information on creating ColumnFilterInfo objects to represent specific filter criteria, refer to the Advanced Filter and Search Concepts topic.
The following code shows how to remove all the items in a regular filter dropdown list except for the predefined ones, and then add a new value item 'VIP Client' to the CustomerID column.
General Information WinForms Controls. XtraWizard ASP. View this topic on docs. Property Description Column Gets the grid column being processed. ComboBox Gets an object providing access to the filter dropdown's items.
Copyright c Developer Express Inc. All rights reserved. General Information. WinForms Controls. NET Core Support. What's Installed. Build an Application. Controls and Libraries. Common Features. Get More Help.When ListItemHoverCssClass is specified and the ComboBox list is scrollable, highlighting a list item will cause the scrollbar to flicker when using the Internet Explorer web browser.
ComboBox Demonstration. ComboBox Description. ComboBox Properties. BackColor - A background color. BorderColor - The ComboBox border color. BorderStyle - The ComboBox border style. BorderWidth - The ComboBox border width. CaseSensitive - Specifies whether or not user-typed text matches items in the list in a case-sensitive manner. The default is false. DropDownStyle - Determines whether or not a user is allowed to enter text that does not match an item in the list and if the list is always displayed.
Enabled - Determines whether or not the ComboBox is enabled. Font - The ComboBox control font. ForeColor - A foreground color.
Height - ComboBox height. ItemInsertLocation - Determines if to "Append" or "Prepend" new items when they are inserted into the list or insert them in an "Ordinal" manner alphabetically based on the item Text or Value.
The default is "Append" ListItemHoverCssClass - When specified, replaces default styles applied to highlighted items in the list with a custom css class. MaxLength - Specifies maximum length of the associated TextBox control.
The default is Inline. SelectedIndex - The ComboBox selected item index.
TabIndex - The ComboBox tab index. Width - ComboBox width. RenderControl writer - Renders a control. ItemInserting - Fires on inserting an item. ComboBox Known Issues. ComboBox Theming. It has a default style which is embedded as a WebResource and is a part of the Toolkit assembly that has styles set for all the sub-classes. If your CssClass does not provide values for any of those then it falls back to the default value. In the example above the default style is displayed when "[Empty String]" is selected as the CssClass.
To customize the same the user would have to set the CssClass property to the name of the CSS style and define the styles for the individual classes so that the various elements in a ComboBox control can be styled accordingly.
Cascading Combo Boxes
For example, if the CssClass property was set to "CustomComboBoxStyle", this is how the css to style the border and background color would look:.The ASPxGridView provides layout features, such as cell merging, templates, and support for master-detail data presentation allowing you to build grid layouts of any complexity. This demo illustrates how the ASPxGridView control works easily and quickly with a data source consisting ofrecords.
The Search panel allows end-users to filter data and highlight search results by typing filter criteria in the panel's editor. This demo illustrates the main features provided by the grid search panel.
The Batch edit mode speeds up the grid control's performance by eliminating excessive data updates. The main objective is to update the grid control only once - after all the necessary changes have been made. In this demo, end-users can modify data on the client side and send it to the server in a single request. DevExpress ASP. You can display detail records within its master-detail layout in a format most suitable for your business needs including the ability to display collapsible row preview sections.
How to: Filter a LookUp(ComboBox) Column Based on Another Column Value
The Grid View can automatically resize or hide grid data when the browser window is resized, allowing you to build adaptive or responsive page layouts with ease. Mobile-friendly Customization Dialog helps end-users refine grid data when working under touch-enabled user interfaces.
In this demo, grid data is highlighted by applying several formatting rules. Get started today and download your day trial of ASP. NET Controls and Libraries includes 30 days of free technical support. NET distribution. Refer to the Demos and Sample Applications topic to learn more.
NET Subscriptions and are backed by a 60 day unconditional money-back guarantee. To learn more and obtain pricing information, visit the Compare Features and Pricing webpage. For immediate assistance, contact us by Email at info devexpress. No results found for. All Demos.