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

ToolBar / Images

Configuration
Display Type:
Image position:

  • There are three ways toolbar items can look. You can customize every item and made it look unique. You can use either display text, picture or both.

    Use the ImageUrl property to specify the URL to the image, which the RadToolBarItem will use. If you want the item to display only an image without a text, you should set the Text property to an empty string.

    Use the ImagePosition property of the RadToolBarItem to specify whether the image should be displayed to the left, right, top or bottom of the text.

    You can define custom images for the different RadToolBarItem states:

    • ImageUrl - used when the item is in its normal state
    • DisabledImageUrl - used when the item is disabled (Enabled = false)
    • FocusedImageURL - used when the item is focused after tabbing to it with the keyboard.
    • ClickedImageURL - used when the left mouse key is pressed over the item
    • HoveredCssClass - used when the mouse cursor is over the item
    • CheckedCssClass - used when a button checked state is true (applies only to RadToolBarButton).

Source Code

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

    <%@ 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.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag ID="Headtag1" runat="server" />
        <style type="text/css">
            #radioButtonsContainer
            {
                float: right;
                position: relative;
                top: -25px;
                left: 10px;
            }
            
            div.RadToolBarDropDown .rtbImageOnly
            {
                padding-left: 0;
            }
            
            div.RadToolBarDropDown .rtbImageOnly .rtbIcon
            {
                position: relative;
                top: 1px;
                padding-bottom: 2px;
            }
        </style>

        <script type="text/javascript">
            function onClientButtonClicking(sender, args) {
                var button = args.get_item();
                var parent = button.get_parent();
                var toolBar = button.get_toolBar();
                var alignDropDown = toolBar.get_items().getItem(5);
                
                if (parent == alignDropDown)
                    alignDropDown.set_imageUrl(button.get_imageUrl());
            }
        </script>

    </head>
    <body class="BODY">
        <form id="mainForm" method="post" runat="server">
        <telerik:RadScriptManager ID="ScriptManager" runat="server" />
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#" XhtmlCompliant="False" />
        <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configuration" Orientation="Vertical" Expanded="true">
            <strong>Display Type:</strong>
    <asp:RadioButtonList ID="rblDisplayType" runat="server" Style="margin-bottom: 15px;"
    AutoPostBack="true" OnSelectedIndexChanged="rblDisplayType_SelectedIndexChanged">

                <asp:ListItem Text="Text and Image" Selected="true" />
                <asp:ListItem Text="Text Only" />
                <asp:ListItem Text="Image Only" />
            </asp:RadioButtonList>
            <strong>Image position:</strong>
            <asp:RadioButtonList ID="rblImagePosition" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblImagePosition_SelectedIndexChanged">
                <asp:ListItem Text="Left" Selected="true" />
                <asp:ListItem Text="Right" />
                <asp:ListItem Text="AboveText" />
                <asp:ListItem Text="BelowText" />
            </asp:RadioButtonList>
        </qsf:ConfiguratorPanel>
        <telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicking="onClientButtonClicking" EnableRoundedCorners="true" EnableShadows="true">
            <Items>
                <telerik:RadToolBarButton ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/back.gif"
                    Text="Back" ToolTip="Back">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarButton ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/forward.gif"
                    Text="Forward" ToolTip="Forward">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarButton ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/bold.gif"
                    Text="Bold" CheckOnClick="true" AllowSelfUnCheck="true" Group="Bold" ToolTip="Bold">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarButton ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/italic.gif"
                    Text="Italic" CheckOnClick="true" AllowSelfUnCheck="true" Group="Italic" ToolTip="Italic">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarButton ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/underline.gif"
                    Text="Underline" CheckOnClick="true" AllowSelfUnCheck="true" Group="Underline"
                    ToolTip="Underline">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarDropDown Text="Align" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/align.gif"
                    ToolTip="Align">
                    <Buttons>
                        <telerik:RadToolBarButton Text="Left" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/left.gif"
                            CheckOnClick="true" Group="Align" ToolTip="Align Left">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Center" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/center.gif"
                            CheckOnClick="true" Group="Align" ToolTip="Align Center">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Right" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/right.gif"
                            CheckOnClick="true" Group="Align" ToolTip="Align Right">
                        </telerik:RadToolBarButton>
                    </Buttons>
                </telerik:RadToolBarDropDown>
                <telerik:RadToolBarSplitButton>
                    <Buttons>
                        <telerik:RadToolBarButton Text="Red" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/red.gif"
                            CheckOnClick="true" Group="Color" ToolTip="Set Color Red">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Blue" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/blue.gif"
                            CheckOnClick="true" Group="Color" ToolTip="Set Color Blue">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Green" ImageUrl="~/ToolBar/Examples/Appearance/Images/Img/green.gif"
                            CheckOnClick="true" Group="Color" ToolTip="Set Color Green">
                        </telerik:RadToolBarButton>
                    </Buttons>
                </telerik:RadToolBarSplitButton>
            </Items>
        </telerik:RadToolBar>
        <qsf:Footer ID="Footer1" runat="server" />
        </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