Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q1 2012 released 04/11/2012
select

ColorPicker / Defining the Colors


  • Defining the colors

    RadColorPicker provides simple, yet flexible ways of defining the colors in the color palette. There are 3 ways to define the colors in the palette:
    • Using the Preset property - a user can choose from a number of predefined (embedded) palettes. See the available predefined palettes.
    • Defining the Items collection - this allows a user to set his own colors in the color palette
    • Using the Preset property and the Items collection - you can extend the colors of a predefined palette by combining multiple palettes or adding custom colors to an existing palette.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.ColorPicker.ColorsDefinition.DefaultCS"
        CodeFile="DefaultCS.aspx.cs" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!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">
        <qsf:HeadTag ID="Headtag1" runat="server" />
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div class="module">
            <qsf:InformationBox ID="InformationBox1" runat="server" Title="Color Picker defined using the <b>Standard</b> preset palette:">
            </qsf:InformationBox>
            <telerik:RadColorPicker runat="server" ID="RadColorPicker1" Preset="Standard" Style="margin: auto;" />
        </div>
        <div class="module">
            <qsf:InformationBox ID="InformationBox2" runat="server" Title="Color Picker defined using the <b>Items</b> collection:">
            </qsf:InformationBox>
            <telerik:RadColorPicker runat="server" ID="RadColorPicker2" Columns="5" Width="210"
                Preset="None" Style="margin: auto;">
                <telerik:ColorPickerItem Title="Yellow" Value="#FFFF00" />
                <telerik:ColorPickerItem Title="Light Green" Value="#00FF00" />
                <telerik:ColorPickerItem Title="Turquoise" Value="#00FFFF" />
                <telerik:ColorPickerItem Title="Pink" Value="#FF00FF" />
                <telerik:ColorPickerItem Title="Blue" Value="#0000FF" />
                <telerik:ColorPickerItem Title="Red" Value="#FF0000" />
                <telerik:ColorPickerItem Title="Dark Blue" Value="#000080" />
                <telerik:ColorPickerItem Title="Teal" Value="#008080" />
                <telerik:ColorPickerItem Title="Green" Value="#008000" />
                <telerik:ColorPickerItem Title="Violet" Value="#800080" />
                <telerik:ColorPickerItem Title="Dark Red" Value="#800000" />
                <telerik:ColorPickerItem Title="Dark Yellow" Value="#808000" />
                <telerik:ColorPickerItem Title="Gray - 50%" Value="#808080" />
                <telerik:ColorPickerItem Title="Gray - 25%" Value="#C0C0C0" />
                <telerik:ColorPickerItem Title="Black" Value="#000000" />
            </telerik:RadColorPicker>
        </div>
        <div class="module">
            <qsf:InformationBox ID="InformationBox3" runat="server" Title="Color Picker defined using the <b>Items</b> collection and a <b>Grayscale</b> preset:">
            </qsf:InformationBox>
            <telerik:RadColorPicker runat="server" ID="RadColorPicker4" Preset="Grayscale" Style="margin: auto;">
                <telerik:ColorPickerItem Title="Blue" Value="#0000FF" />
                <telerik:ColorPickerItem Title="Red" Value="#FF0000" />
                <telerik:ColorPickerItem Title="Green" Value="#008000" />
                <telerik:ColorPickerItem Title="Black" Value="#000000" />
            </telerik:RadColorPicker>
        </div>
        <div class="module">
            <qsf:InformationBox ID="InformationBox4" runat="server" Title="Color Picker defined using the <b>Grayscale</b> and <b>Standard</b> presets:">
            </qsf:InformationBox>
            <!-- see code behind -->
            <telerik:RadColorPicker runat="server" ID="RadColorPicker5" Preset="None" Style="margin: auto;">
            </telerik:RadColorPicker>
        </div>
        <qsf:Footer runat="server" ID="Footer1" />
        </form>
    </body>
    </html>

Get more than expected!

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2012 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451