Back to Devexpress

ColorEdit

aspnetmvc-8983-components-data-editors-extensions-coloredit.md

latest1.5 KB
Original Source

ColorEdit

  • Dec 17, 2020
  • 2 minutes to read

ColorEdit represents a color editor control that has a dropdown window with a color palette.

Implementation Details

ColorEdit is realized by the ColorEditExtension class. Its instance can be accessed via the ExtensionsFactory.ColorEdit helper method, which is used to add a ColorEdit extension to a view. This method’s parameter provides access to the ColorEdit ‘s settings implemented by the ColorEditSettings class, allowing you to fully customize the extension.

ColorEdit ‘s client counterpart is represented by the ASPxClientColorEdit object.

Declaration

ColorEdit can be added to a view in the following manner.

razor
@Html.DevExpress().ColorEdit(settings => {
    settings.Name = "colorEdit1";
    settings.Color = System.Drawing.Color.FromName("red");
}).GetHtml()

Note

The Partial View should contain only the extension’s code.

The code result is demonstrated in the image below.

Main Features

  • Easy Color Selection

  • Color on Error

  • Built-in Validation

  • Full-Featured Client-Side API