ASPxPropertyEditor Class
The base class for Property Editors that use controls inherited from ASPxEditBase.
Namespace: DevExpress.ExpressApp.Web.Editors.ASPx
Assembly: DevExpress.ExpressApp.Web.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Web
Declaration
Remarks
ASPxPropertyEditor is a base class for custom Property Editors that use controls derived from ASPxEditBase. To use another control, inherit WebPropertyEditor instead.
The ASPxPropertyEditor class extends the WebPropertyEditor class functionality:
- The ASPxPropertyEditor class provides the default implementation of the ReadEditModeValueCore and GetControlValueCore methods. These methods imply that all the controls have the Value property of the object type.
- The ASPxEditor protected property is introduced. It returns a DevExpress.Web.ASPxEditors.ASPxEditBase object that is the Property Editor’s control used in edit mode.
- The SetImmediatePostDataScript method is overridden to support the ImmediatePostData functionality.
- The SetProcessValueChangedScript method is overridden to support the ConfirmUnsavedChanges mode.
- The ValidationExpression and ErrorText properties are set depending on the EditMask value.
- The ApplyReadOnly method is overridden to set the ClientEnabled and ReadOnly properties, depending on the ASPxPropertyEditor.AllowEdit property value.
To create a minimal property editor inherited from the ASPxPropertyEditor class, implement the CreateEditModeControlCore method. It’s required to subscribe to the control’s ValueChanged event to call the EditValueChangedHandler method (raises the PropertyEditor.ControlValueChanged event and calls the PropertyEditor.WriteValue method). To instantiate ASP.NET Web Forms controls, use static helper methods of the RenderHelper class.
protected override WebControl CreateEditModeControlCore() {
ASPxSpinEdit spinEdit = RenderHelper.CreateASPxSpinEdit();
// Setup 'editModeControl' here.
spinEdit.NumberChanged += EditValueChangedHandler;
return spinEdit;
}
Refer to the WebPropertyEditor Class topic for details on creating custom Property Editors.
Note
- All built-in XAF ASP.NET Web Forms Property Editors inherit ASPxPropertyEditor.
- A custom Property Editor that derives from the ASPxPropertyEditor should not throw exceptions. These exceptions interrupt the request processing. As a result, the application crashes.
Examples of Property Editors derived from ASPxPropertyEditor:
- How to: Customize a Built-in Property Editor (ASP.NET Web Forms)
- How to: Supply Predefined Values for the String Property Editor Dynamically (ASP.NET Web Forms)