How to set a ToolBarButton image sprite on the client

2 posts, 0 answers
  1. Tom
    Tom avatar
    49 posts
    Member since:
    Oct 2010

    Posted 14 Nov 2016 Link to this post

    How do I go about setting a ToolBarButton image sprite on the client side? I want to change the sprite css class depending on user action.

    On the server side, I successfully set the sprite for the buttons "Option1" and "Option2" in my toolbar "rtbarLs" like this:

    RadToolBarButton rtbb1 = (RadToolBarButton)rtbarLs.FindItemByValue("Option1");
    rtbb1.SpriteCssClass = "spriteCheck";
    rtbb1.EnableImageSprite = true;
    RadToolBarButton rtbb2 = (RadToolBarButton)rtbarLs.FindItemByValue("Option2");
    rtbb2.SpriteCssClass = "spriteBlank";
    rtbb2.EnableImageSprite = true;


    On the client side, I tried this:

    var rtbarSumm = window.$find("<%= rtbarLs.ClientID %>");


    but the spriteCssClass for ToolBarButton "Option2" is still "spriteBlank". Note that there is no JavaScript error reported in the debugger console.


  2. Ivan Danchev
    Ivan Danchev avatar
    1853 posts

    Posted 16 Nov 2016 Link to this post

    Hi Tom,

    The set_spriteCssClass() method is inherited from the RadToolBarItem object, but the sprite's CssClass is not updated when calling the method, because currently there is no related implementation. In other words the method is just a placeholder, this is why there is no javascript error when calling it, but there is no actual functionality implemented for this method. For that reason it is not listed in the RadToolBarButton methods section of the documentation. The set_spriteCssClass() method is not an exception, there are other placeholder methods that are not listed in the documentation, because they haven't been implemented yet, for instance set_disabledCssClass().

    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top