| |
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" VerticalPosition="Top" OffsetTop="-100"> <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"/>
See the full source code in /ColorPicker/aspnet_postBack.aspx file of downloaded Suite.
| | |
| "The grid itself is excellent.
I'm amazed by what you have accomplished with it.
It has become the main control for our pages
due to our customers responses to layouts with it." |
Mark Butler |
| Achieve Technology |
| | |
|
|
|
|