| |
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=" " />
See the full source code in /ColorPicker/aspnet_postBack.aspx file of downloaded Suite.
| | |
| "Your TreeView component with the use of the Tree DB component are a real winner.
I am using this with my CMS applications that allow the user to order
the documents with a simple drag and drop.
It's brilliant and my clients now have a more intuitive application." |
Ben de Groot |
|
| | |
|
|
|
|