RadRibbonBar Tab Image?

3 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    12 posts
    Member since:
    Aug 2015

    Posted 25 May Link to this post

    I need have a RadRibbonBar with four main tabs. I cannot seem to find any documentation about adding images on the tab itself. The RadTabStrip has an ImageURL property. Would I have to use a TemplateControl to achieve this?
  2. Jonathan
    Jonathan avatar
    12 posts
    Member since:
    Aug 2015

    Posted 26 May Link to this post

    I was unable to figure out how to do this on the server side but I have implemented a client side method of appending images to a tab. The only thing I had to do server side was add an attribute to each tab defining the ImageURL for that tab. Then, on the client iterate through the tabs and append the image. Hope this helps someone else.

    $(document).ready(function ()
    {
        // add the images on the initial page load
        AddTabImages();
     
        // add the images every partial postback
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(AddTabImages);
    });
     
    function AddTabImages(tabID, imageID)
    {  
        var tabs = $('.rrbTab');
         
        $.each(tabs, function ()
        {
            var tabLabel = $(this).find('.rrbTabText');
            var imageURL = $(this).attr('ImageUrl');
            var image = document.createElement('img');
     
            image.className = 'rrbTabImage';
            image.src = imageURL;
     
            $(image).insertBefore(tabLabel);
        });
    }

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 30 May Link to this post

    Hello Jonathan,

    Thank you for sharing your approach for setting images to the tabs. Indeed the inability to do this by setting an ImageUrl property of the RibbonBarTab currently is a limitation of the RibbonBar. I would suggest logging this as a feature request and voting for it in our Feedback Portal.

    Regards,
    Ivan Danchev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top