aspnetbootstrap-400712-data-editors-color-edit.md
The BootstrapColorEdit control allows end users to specify a color. They can type a value in the edit box or pick a color from the drop-down palette.
The main Bootstrap Color Edit features are:
You can use any of the following notations to specify colors in the edit box:
To disable the editor’s text box, set the AllowUserInput property to false.
Use the Color / Value properties to specify the editor’s value (color-based or in text format).
To show the Custom Color palette, set the EnableCustomColors property to true.
Use the Items property to customize the drop-down color palette.
<dx:BootstrapColorEdit ID="ColorEditPallete" runat="server"/>
protected void Page_Load(object sender, EventArgs e) {
ColorEditPallete.Items.Clear();
ColorEditPallete.Items.Add(System.Drawing.Color.FromArgb(86, 61, 124));
ColorEditPallete.Items.Add(System.Drawing.Color.FromArgb(203, 189, 226));
ColorEditPallete.Items.Add(System.Drawing.Color.FromArgb(229, 225, 234));
ColorEditPallete.Items.Add(System.Drawing.Color.FromArgb(249, 249, 249));
ColorEditPallete.Items.Add(System.Drawing.Color.FromArgb(255, 255, 255));
ColorEditPallete.Items.Add(System.Drawing.Color.FromArgb(255, 255, 255));
}
To show an Automatic Color Item at the top of the palette, set the EnableAutomaticColorItem property to true and use the AutomaticColor property to specify item’s color.
When a user enters an incorrect color code into the Color Edit, the control is automatically set to the previous valid color. To change this behavior, set the ColorOnError property to Null so that the control is set to a null value in these cases.
Use the Caption and the HelpText properties to specify the Color Edit’s caption and auxiliary help text.
Use the NullText property to display prompt text (watermark) in the editor’s edit box. The specified text is displayed when the editor’s value is null and the editor is not focused. The prompt text disappears when the editor is focused.
To specify whether the text should also be displayed in the focused state, use the NullTextDisplayMode property.
<dx:BootstrapColorEdit runat="server" NullText="Select a color" NullTextDisplayMode="UnfocusedAndFocused"/>
The Bootstrap Color Edit control allows you to validate user input on the client and server side. Refer to the Validation topic for more information.
On the client side, use the BootstrapClientColorEdit class to interact with the editor as specified below:
DevExpress Bootstrap controls are shipped with online feature-based demos. To preview the Bootstrap Color Editor and its features, click See Demos.