ASP.NET Color Picker - Post back to server

Click to the box:
Color Picker
  

 

This example demonstrates how to post back selected color to Server.

Example code

<script runat="server" language="c#">
void Page_load(object sender, EventArgs e){
   if(!IsPostBack){
       if(HiddenValue.Value.Length==0)
color.Style["background-color"] = HiddenValue.Value = "#FFFFFF";
       else                                          
color.Style["background-color"] = HiddenValue.Value;
   }
   else
       Message.Text = "Submitted color: " + (color.Style["background-color"] = HiddenValue.Value);
}
</script>
<script type="text/JavaScript">
function OnColorOpen(sender){
  var textBox = document.getElementById("<%= color.ClientID %>");
  sender.setColor(OboutInc.ColorPicker.getStyle(textBox,"background-color"));
}
function OnColorPicked(sender){
  var hidden  =document.getElementById("<%=HiddenValue.ClientID %>");
  hidden.value=sender.getColor();
}
</script>
...
<asp:HiddenField runat="server" id="HiddenValue" value="" />
Click to the box:
<obout:ColorPicker runat="server" OnClientOpen="OnColorOpen" OnClientPicked="OnColorPicked"
                             TargetId="color" TargetProperty="style.backgroundColor" >
      <asp:TextBox readOnly="true" id="color" style="cursor: pointer;" runat="server"/>
</obout:ColorPicker>
<asp:Button runat="server" Text="Submit"/><br/><br/>
<asp:label id="Message" runat="server" Text="&nbsp;" />

See the full source code in /ColorPicker/aspnet_postBack.aspx file of downloaded Suite.