ASP.NET Pack Programmer's Guide
ColorPicker

The ColorPicker control represents a text-box control with the ability to parse and select colors from a popup preset.

Server side

Getting and setting the control's color

Use the ColorPicker.Value property to get or set the control's current color.

Customizing the control

The ColorPicker control supports three different types of palette color presets as specified in the ColorPreset enumeration.

The position of the popup preset can be adjusted by using the PopupAlignRight and PopupAlignTop properties.

Events

The following events are exposed by the ColorPicker class.

Event

Event arguments

Description

ValueChanged

ValueChangedEventArgs<Color>

Raised when the control's value has changed

Client side

Getting a reference to the control

You can access the control on the client side by its ClientID.

JavaScript  Copy Code

var colorPicker = $find("ColorPicker1");
var colorPicker = $find("<%= ColorPicker1.ClientID %>");

Getting and setting the control's color

Use the get_value and set_value methods to get or set the control's color.

JavaScript  Copy Code

colorPicker.set_value("#FF0000");
alert(colorPicker.get_value());

Events

The following client-side event are exposed by the ColorPicker class.

Event

Event arguments

Script property

Description

valueChanged

ValueChangedEventArgs

ValueChangedScript

Raised when a control value has changed.

controlLoaded

-

ControlLoadedScript

Raised just after the control has finished loading and is ready for interaction.

popupOpen

PopupEventArgs

PopupOpenScript

Raised when the control's popup is opened.

popupClose

PopupEventArgs

PopupCloseScript

Raised when the control's popup is closed.

popupOpening

PopupEventArgs

PopupOpeningScript

Raised when the control's popup is about to be opened.

popupClosing

PopupEventArgs

PopupClosingScript

Raised when the control's popup is about to be closed.