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 Q2 2011 released 07/12/2011
select

Button / Custom Icons

Change Button Type:

  • RadButton can be decorated with custom icons by setting the PrimaryIconUrl and/or SecondaryIconUrl properties. To specify custom icons for the button's hover effect set the PrimaryHoveredIconUrl and/or SecondaryHoveredIconUrl properties. For precise icon positioning use the PrimaryIconTop, PrimaryIconRight, PrimaryIconBottom and PrimaryIconLeft properties for the primary icon. For the secondary icon set the SecondaryIconTop, SecondaryIconRight, SecondaryIconBottom and SecondaryIconLeft properties.
    Note, that it is recommended to use 16x16px icons when working with Standard and Link button types.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Button.CustomIcons.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" />
        <link href="rbPredefinedIcons.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .predIcons
            {
                font-family: "Segoe UI" ,Arial,Helvetica,sans-serif;
                font-size: 12px;
                border-collapse: collapse;
                margin: 0 auto;
                color: #000;
            }
            .predIcons td
            {
                padding: 6px 6px 6px 10px;
                border: 1px solid #ddd;
            }
            .predIcons tr
            {
                background-color: #fff;
            }
            .predIcons tr.dark
            {
                background-color: #efefef;
            }
            .predIcons tr:hover
            {
                background-color: #FDFEE3;
            }
            .predIcons tr.head
            {
                border: 0;
                background: transparent;
            }
            .predIcons tr.head:hover
            {
                background: none;
            }
            .predIcons tr.head td
            {
                border: 0;
            }
            .text
            {
                display: block;
                width: 100px;
                float: right;
                text-align: left;
                padding-right: 15px;
            }
            .predIcons .rborder
            {
                border-right: 3px solid #ddd;
                padding-right: 10px;
            }
        </style>
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
        <telerik:RadScriptManager ID="ScriptManager" runat="server" />
        <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Enabled="true" Title="Change Button Type: "
            Expanded="true" Style="text-align: left; margin: auto;" HorizontalAlign="Right"
            Width="450px">
    <asp:RadioButtonList OnSelectedIndexChanged="ChangeButtonType_SelectedIndexChanged"
    RepeatDirection="Horizontal" ID="rblChangeButtonType" runat="server" AutoPostBack="True">

                <asp:ListItem Value="StandardButton" Selected="True">Standard Button</asp:ListItem>
                <asp:ListItem Value="LinkButton">Link Button</asp:ListItem>
            </asp:RadioButtonList>
        </qsf:ConfiguratorPanel>
        <asp:Panel ID="Panel1" runat="server">
            <table cellpadding="0" cellspacing="0" border="0" class="predIcons">
                <thead>
                    <tr>
                        <td style="width: 200px;">
                            <label>
                                <strong>Primary Icon</strong></label>
                        </td>
                        <td style="width: 200px;">
                            <label>
                                <strong>Secondary Icon</strong></label>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            <telerik:RadButton ID="RadButton1" runat="server" Text="Find">
                                <Icon PrimaryIconUrl="Icons/eFind.png" PrimaryIconLeft="4" PrimaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton2" runat="server" Text="Find">
                                <Icon SecondaryIconUrl="Icons/eFind.png" SecondaryIconRight="4" SecondaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr class="dark">
                        <td>
                            <telerik:RadButton ID="RadButton3" runat="server" Text="Close">
                                <Icon PrimaryIconUrl="Icons/eClose.png" PrimaryIconLeft="7" PrimaryIconTop="6" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton4" runat="server" Text="Close">
                                <Icon SecondaryIconUrl="Icons/eClose.png" SecondaryIconRight="6" SecondaryIconTop="6" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <telerik:RadButton ID="RadButton5" runat="server" Text="Flash">
                                <Icon PrimaryIconUrl="Icons/eFlash.png" PrimaryIconLeft="6" PrimaryIconTop="3" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton6" runat="server" Text="Flash">
                                <Icon SecondaryIconUrl="Icons/eFlash.png" SecondaryIconRight="6" SecondaryIconTop="3" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr class="dark">
                        <td>
                            <telerik:RadButton ID="RadButton7" runat="server" Text="Html">
                                <Icon PrimaryIconUrl="Icons/eHtml.png" PrimaryIconLeft="5" PrimaryIconTop="3" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton8" runat="server" Text="Html">
                                <Icon SecondaryIconUrl="Icons/eHtml.png" SecondaryIconRight="5" SecondaryIconTop="3" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <telerik:RadButton ID="RadButton9" runat="server" Text="Player">
                                <Icon PrimaryIconUrl="Icons/ePlayer.png" PrimaryIconLeft="6" PrimaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton10" runat="server" Text="Player">
                                <Icon SecondaryIconUrl="Icons/ePlayer.png" SecondaryIconRight="7" SecondaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr class="dark">
                        <td>
                            <telerik:RadButton ID="RadButton11" runat="server" Text="Rate">
                                <Icon PrimaryIconUrl="Icons/eRate.png" PrimaryIconLeft="6" PrimaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton12" runat="server" Text="Rate">
                                <Icon SecondaryIconUrl="Icons/eRate.png" SecondaryIconRight="6" SecondaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <telerik:RadButton ID="RadButton13" runat="server" Text="SpellCheck">
                                <Icon PrimaryIconUrl="Icons/eSpellCheck.png" PrimaryIconLeft="4" PrimaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton14" runat="server" Text="SpellCheck">
                                <Icon SecondaryIconUrl="Icons/eSpellCheck.png" SecondaryIconRight="6" SecondaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr class="dark">
                        <td>
                            <telerik:RadButton ID="RadButton15" runat="server" Text="Time">
                                <Icon PrimaryIconUrl="Icons/eTime.png" PrimaryIconLeft="6" PrimaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton16" runat="server" Text="Time">
                                <Icon SecondaryIconUrl="Icons/eTime.png" SecondaryIconRight="6" SecondaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <telerik:RadButton ID="RadButton17" runat="server" Text="Tools">
                                <Icon PrimaryIconUrl="Icons/eTools.png" PrimaryIconLeft="6" PrimaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                        <td>
                            <telerik:RadButton ID="RadButton18" runat="server" Text="Tools">
                                <Icon SecondaryIconUrl="Icons/eTools.png" SecondaryIconRight="6" SecondaryIconTop="4" />
                            </telerik:RadButton>
                        </td>
                    </tr>
                </tbody>
            </table>
        </asp:Panel>
        <qsf:Footer runat="server" ID="Footer1" ShowCodeViewer="true" />
        </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-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451