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
  • Rate / Review
    • Give your Feedback:

      Rate this demo:


ColorPicker / Changing Theme

Currant

Username:
Password:
Log in
Currant
Strawberry
Peach
Lemon
Lime

  • Changing Theme

    This is a sample application scenario which shows how to use RadColorPicker to implement theme customization for your forms. You can apply a different selection of color for a quick change of styles.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.ColorPicker.AppScenario2.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" />
        <style type="text/css">
            .divContainer
            {
                background: url('Images/background.jpg') no-repeat;
                width: 879px;
                height: 349px;
            }
            .currantClass
            {
                background: url('Images/currant.jpg') no-repeat bottom;
                float: left;
                width: 250px;
                height: 232px;
                padding: 79px 0 0 253px;
                color: #6e3fbc;
            }
            .strawberryClass
            {
                background: url('Images/strawberry.jpg') no-repeat bottom;
                float: left;
                width: 250px;
                height: 232px;
                padding: 79px 0 0 253px;
                color: #ff256f;
            }
            .peachClass
            {
                background: url('Images/peach.jpg') no-repeat bottom;
                float: left;
                width: 250px;
                height: 232px;
                padding: 79px 0 0 253px;
                color: #ff6600;
            }
            .lemonClass
            {
                background: url('Images/lemon.jpg') no-repeat bottom;
                float: left;
                width: 250px;
                height: 232px;
                padding: 79px 0 0 253px;
                color: #fff000;
            }
            .limeClass
            {
                background: url('Images/lime.jpg') no-repeat bottom;
                float: left;
                width: 250px;
                height: 232px;
                padding: 79px 0 0 253px;
                color: Lime;
            }
            .chooseColorClass
            {
                float: left;
                padding: 100px 0 0 40px;
                width: 60px;
                height: 200px;
            }
        </style>
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" ShowSkinChooser="false" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>

        <script type="text/javascript">
            function ChangeImageColor(sender, eventArgs)
            {
                setTimeout(function()
                {
                    var title = $get("Title_H1");
                    var loginDiv = $get("loginDiv");
                    var color = sender.get_selectedColorTitle();
                    title.innerHTML = color;
                    loginDiv.className = color.toLowerCase() + "Class";
                }, 10);
            }            
        </script>

        <div class="divContainer">
            <div id="loginDiv" class="currantClass">
                <table>
                    <tr>
                        <td colspan="2">
                            <h1 id="Title_H1" style="font-family: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif;">
                                Currant</h1>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; text-align: right; padding-right: 5px;">
                            Username:
                        </td>
                        <td>
                            <input type="text" style="border: 1px solid Silver; height: 20px;" />
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right; padding-right: 5px;">
                            Password:
                        </td>
                        <td>
                            <input type="text" style="border: 1px solid Silver; height: 20px;" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td style="text-align: right; padding-right: 20px; line-height: 40px;">
                            Log in
                        </td>
                    </tr>
                </table>
            </div>
            <div id="chooseColorDiv" class="chooseColorClass">
                <telerik:RadColorPicker runat="server" ID="RadColorPicker1" ShowEmptyColor="false"
                    PreviewColor="false" OnClientColorChange="ChangeImageColor" SelectedColor="#FFFF00"
                    Columns="1" Width="26" Style="margin-left: 23px;" Preset="None">
                    <telerik:ColorPickerItem Title="Currant" Value="#6e3fbc" />
                    <telerik:ColorPickerItem Title="Strawberry" Value="#ff256f" />
                    <telerik:ColorPickerItem Title="Peach" Value="#ff6600" />
                    <telerik:ColorPickerItem Title="Lemon" Value="#fff000" />
                    <telerik:ColorPickerItem Title="Lime" Value="Lime" />
                </telerik:RadColorPicker>
            </div>
            <div style="float: left; line-height: 22px; color: #666666; font-size: 11px; font-weight: bold;
                padding-top: 100px;">
                Currant<br />
                Strawberry<br />
                Peach<br />
                Lemon<br />
                Lime
            </div>
        </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