ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - Color Picker - Custom colors

Click to the TextBox to select background color:

Color PickerClose the picker
ASP.NET
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.ColorPicker" TagPrefix="obout" %>
<script runat="server" language="c#">
protected void color_postback(object sender, Obout.Ajax.UI.ColorPicker.ColorPostBackEventArgs e)
{
  textbox.Style[HtmlTextWriterStyle.BackgroundColor] = e.Color;
}
</script>
...
<script type="text/JavaScript"> function onClientOpen(sender, args) {
   sender.setColor(sender.get_targetElement().style.backgroundColor);
}
</script>
...
<asp:TextBox runat="server" Text="" id="textbox" ReadOnly="true"
    style="cursor: pointer; background-color: #FFFFFF" />
<obout:ColorPickerExtender runat="server" ID="picker" OnClientOpen="onClientOpen"
    OnColorPostBack="color_postback" AutoPostBack="true" TargetProperty="style.backgroundColor"
    PopupButtonID="textbox" TargetControlID="textbox" >
<CustomColors>
<obout:CustomColor Value="TRANSPARENT" Title="transparent" />
<obout:CustomColor Value="#FFFF00" />
<obout:CustomColor Value="#00FF00" />
<obout:CustomColor Value="#ADD8E6" />
<obout:CustomColor Value="#008000" />
<obout:CustomColor Value="#808080" />
<obout:CustomColor Value="#FFD700" />
<obout:CustomColor Value="#FFE4E1" />
<obout:CustomColor Value="#00FFFF" />
<obout:CustomColor Value="#87CEEB" />
<obout:CustomColor Value="#0000FF" />
<obout:CustomColor Value="#A9A9A9" />
<obout:CustomColor Value="#FFA500" />
<obout:CustomColor Value="#FFC0CB" />
<obout:CustomColor Value="#A52A2A" />
<obout:CustomColor Value="#008080" />
<obout:CustomColor Value="#000080" />
<obout:CustomColor Value="#C0C0C0" />
<obout:CustomColor Value="#FF0000" />
<obout:CustomColor Value="#C71585" />
<obout:CustomColor Value="#8B0000" />
<obout:CustomColor Value="#4B0082" />
<obout:CustomColor Value="#000000" />
<obout:CustomColor Value="#FFFFFF" />
</CustomColors>
</obout:ColorPickerExtender>

"I really appreciate the way you helped and moreover the help came in such an electrifying speed.. Cool. Keep up the good work !!"

Atanu
Rebaca Technologies Pvt. Ltd.

Random testimonial   All testimonials