Log In
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]List Editors
  [Collapse]Property Editors
    How to: Customize a Built-in Property Editor (ASP.NET)
    How to: Customize a Built-in Property Editor (WinForms)
    How to: Disable and Hide Property Editors Based on a Business Rule
    How to: Display an Integer Property as an Enumeration
    How to: Implement a Property Editor Based on a Custom Control (WinForms)
    How to: Implement a Property Editor based on Custom Controls (ASP.NET)
    How to: Implement a Property Editor Using a DevExpress WinForms Control
    How to: Supply Predefined Values for the String Property Editor Dynamically (ASP.NET)
    How to: Supply Predefined Values for the String Property Editor Dynamically (WinForms)
    How to: Use Criteria Property Editors
  [Expand]Scheduler and Notifications
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Supply Predefined Values for the String Property Editor Dynamically (ASP.NET)

This topic describes implementation of a custom ASP.NET Web Property Editor that will be used to edit a business object's CultureCode (locale) property of the String type. The dropdown list of the Property Editor's control will display the cultures returned by the CultureInfo.GetCultures method.


You can also specify predefined values in the Model Editor using the IModelCommonMemberViewItem.PredefinedValues property. This approach is much simpler because it does not require extra coding, but you will be unable to update the values list dynamically in code in this instance.

The image below shows the resulting Property Editor:

To implement a Property Editor by inheriting from the ASPxPropertyEditor class, override the following methods (see ASPxPropertyEditor):

  1. Override the CreateEditModeControlCore method to return the ASPxComboBox control using the RenderHelper class' helper method. Subscribe to the control's ValueChanged event to call the Property Editor's EditValueChangedHandler method. This method updates the associated property when the control's value is changed.
  2. Override the SetupControl method to populate the control's dropdown list with items. We use the CultureInfo.GetCultures method to retrieve the cultures installed.

To specify that the implemented Property Editor can be used for the String type properties, the PropertyEditor attribute is applied (see PropertyEditorAttribute):

Apply the ModelDefaultAttribute attribute to use the implemented Property Editor for a business object's CultureCode property:

Here, the Custom attribute specifies the PropertyEditorType property of the Application Model's IModelMember node, that defines the CultureCode property. Alternatively, you can do it using the Model Editor.


You can see the code demonstrated here, along with more examples on custom Property Editors in the Feature Center Demo located in the %PUBLIC%\Documents\DevExpress Demos 17.2\Components\eXpressApp Framework\FeatureCenter folder, by default, or in the Feature Center demo online.

How would you rate this topic?​​​​​​​