ColorPicker - Server-side Events

OnColorChanged:

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadColorPicker raises the OnColorChanged server side event once its value has been changed.

Set the AutoPostBack property in order for the event handler to be raised right after the value is changed on the client.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="c#" AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.ColorPicker.ServerSideEvents.DefaultCS" %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
        <div class="demo-container">
            <telerik:RadColorPicker RenderMode="Lightweight" ID="RadColorPicker1" Preset="Default" runat="server" AutoPostBack="true"
                OnColorChanged="RadColorPicker1_ColorChanged" PaletteModes="all">
            </telerik:RadColorPicker>
            <p>
                <strong>OnColorChanged:</strong>
                <asp:Label ID="Label1"
                    runat="server"></asp:Label>
            </p>
        </div>
    </div>

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxSettingCreating="RadAjaxManager1_AjaxSettingCreating">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadColorPicker1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Label1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?