New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Static/Dynamic Object Creation

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

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

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<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" ></telerik:RadButton>
            <telerik:RadButton RenderMode="Lightweight" ID="Remove_Button" runat="server" Text="Remove ColorPicker" 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>

Support & Learning Resources

Find Assistance