Ajax Control Toolkit ColorPicker

Modified on 2010/04/15 23:58 by Stephen Walther — Categorized as: Uncategorized

The ColorPicker extender enables you to display a pop-up color picker when the focus is moved to an input element. You can attach the ColorPicker extender to any ASP.NET TextBox control. It provides client-side color-picking functionality with UI in a popup control. Optionally, you can specify a button to display the color-picker popup and a control that previews a color from the color palette. You can also provide a TextBox control where users can enter a color value; the ColorPicker extender can display a custom color even if the color is not in the default color-picker palette.

ColorPicker Server Reference

The properties in italics are optional.

<ajaxToolkit:ColorPickerExtender runat="server" ID="ColorPickerExtender1" TargetControlID="Color1" OnClientColorSelectionChanged="colorChanged" /> The following JavaScript function is called in response to the OnClientColorSelectionChanged event:

function colorChanged(sender) { sender.get_element().style.color = "#" + sender.get_selectedColor(); }

<ajaxToolkit:ColorPickerExtender runat="server" TargetControlID="Color2" PopupButtonID="Image1" SampleControlID="Sample1" SelectedColor="33ffcc" />

ColorPicker Client Reference

Sys.Extended.UI.ColorPickerBehavior Class