ColorPicker - Static/Dynamic Object Creation

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

You can initialize the RadColorPicker in two different ways on your page:

  • Declaratively in the ASPX page
  • Programmatically in the code behind
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.ColorPicker.DynamicObjectCreation.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ 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">
            <h3>Markup Creation</h3>

            <telerik:RadColorPicker RenderMode="Lightweight" runat="server" ID="RadColorPicker1" Preset="Standard">
            </telerik:RadColorPicker>
        </div>

        <div class="demo-container">
            <h3>Programmatic Creation </h3>
            <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
        </div>
    </div>

    <div class="demo-containers">
        <div class="demo-container">
            <h3>Runtime Creation </h3>
            <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>
            <telerik:RadButton RenderMode="Lightweight" ID="Add_Button" runat="server" Text="Create ColorPicker" OnClick="Add_Button_Click"></telerik:RadButton>
            <telerik:RadButton RenderMode="Lightweight" ID="Remove_Button" runat="server" Text="Remove ColorPicker" OnClick="Remove_Button_Click" Visible="false"></telerik:RadButton>
        </div>
    </div>

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Add_Button">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PlaceHolder2"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="Add_Button"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="Remove_Button"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>

            <telerik:AjaxSetting AjaxControlID="Remove_Button">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PlaceHolder2"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="Remove_Button"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="Add_Button"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?