No titles(tooltip) on toolbar buttons

2 posts, 0 answers
  1. Elad
    Elad avatar
    4 posts
    Member since:
    Jun 2013

    Posted 02 Mar 2014 Link to this post

    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
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 06 Mar 2014 Link to this post

    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!

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top