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

RadRibbonBar Tab Image?

2 Answers 62 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 25 May 2016, 07:26 PM
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 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 26 May 2016, 02:36 PM

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);
    });
}

0
Ivan Danchev
Telerik team
answered on 30 May 2016, 12:01 PM
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.
Tags
RibbonBar
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or