- 2 min to read
The ASPxColorEdit control enables your end-users to visually select a color from a dropdown window containing a palette of colors. This control is useful when modifying colors for different elements on a page.
ASPxColorEdit offers the following features.
Easy Color Selection
The ASPxColorEdit editor allows end-users to enter a color with ease by selecting a color from the color palette in the editor's dropdown window, or, if the AllowUserInput property value is set to true, by typing a color code directly into the editor's text box using a longhand or shorthand hexadecimal notation (HEX) for RGB color values (e.g., "#F0F", "#D8D8D8") or RGB color format (e.g., "rgb(255,0,0)"). It is also possible to type HTML color names (e.g., "red", "green"), which are then automatically converted to color codes.
Custom Color Picker
End-users can use an optional color picker to select a custom color. It is disabled by default. Set the ASPxColorEdit.EnableCustomColors property to true to display a custom color section in the editor's drop-down window.
Color on Error
When an end-user inputs the wrong value (i.e., the wrong color code), it is possible to automatically select the previous valid color or a null value. This is defined by the ASPxColorEdit.ColorOnError property. Set it to Undo to automatically select the previous valid color, or set it to Null to select a null value.
The ASPxColorEdit provides rich validation checking capabilities. See the Validation topic to learn more.
Full-Featured Client-Side API
You can operate with editor values using the following methods.
Method Description ASPxClientColorEdit.ColorChanged Fires after the selected color has been changed within the color editor via end-user interaction. ASPxClientColorEdit.GetColor Returns the color editor's value. ASPxClientColorEdit.SetColor Specifies the color value for the color editor.