This is a migrated thread and some comments may be shown as answers.

No titles(tooltip) on toolbar buttons

1 Answer 46 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Elad
Top achievements
Rank 1
Elad asked on 02 Mar 2014, 08:42 AM
Hi,
I am using the RadToolBar in my project while generating the buttons dynamicly:

var toolBarButton = new Telerik.Web.UI.RadToolBarButton();
toolBarButton.set_text(currentState.Text);
toolBarButton.set_enabled(currentState.Enabled);
toolBarButton.set_imageUrl(currentState.ImageUrl);
toolBarButton.set_toolTip(currentState.Tooltip);
toolBarButton.set_commandName(currentState.CommandName);
toolBarButton.set_commandArgument(commandArgs + currentState.OperationType);

The problem is the tooltip goes to the IMG 'alt' attribute instead the 'title' attribute. the IMG tag does not have the 'title' attribute.

This is telerik code taken from RadToolBarScripts.js:

_renderImage:function(b){var a=this.get_enableImageSprite();
var c=a?"span":"img";
b[b.length]="<"+c+" class='rtbIcon'";
if(a){b[b.length]="'></span>";
}else{b[b.length]=" src='";
b[b.length]=this._getCurrentImageUrl();
b[b.length]="' alt='";
b[b.length]=this.get_toolTip();
b[b.length]="'/>";
}}

you can see only alt, no title.

this is taken from package Q2 and Q3 2013

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 06 Mar 2014, 04:33 PM
Hi Elad,

I tested the scenario that you describe and it seems that the tooltip that I set to the button renders as a title attribute to the needed element. Here is my sample code that I used:
<script>
               function createToolBar() {
 
                   var toolBar = $find("<%=RadToolBar1.ClientID %>");
                   toolBar.trackChanges();
                   var dropDown = new Telerik.Web.UI.RadToolBarDropDown();
                   dropDown.set_text("DropDown");
                   var toolBarButton = new Telerik.Web.UI.RadToolBarButton();
                   toolBarButton.set_text("button1");
                   dropDown.get_buttons().add(toolBarButton);
                   toolBarButton.set_toolTip("some tooltip");
                   toolBar.get_items().add(dropDown);
                   toolBar.commitChanges();
               }
           </script>

markup:
<telerik:RadButton runat="server" ID="button1" AutoPostBack="true" Text="create Button" OnClientClicking="createToolBar"></telerik:RadButton>
         <<telerik:RadToolBar runat="server" ID="RadToolBar1">
             <Items>
                 <telerik:RadToolBarButton Text="button1" ToolTip="newww"></telerik:RadToolBarButton>
             </Items>
         </telerik:RadToolBar>


Regards,
Kate
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Tags
ToolBar
Asked by
Elad
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or