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

Custom buttons in toolbar bug

4 Answers 167 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
René
Top achievements
Rank 2
Iron
Iron
Iron
René asked on 12 Dec 2018, 09:06 AM

Tried to add custom buttons to toolbar.

rightsButton = new RadToolBarButton();
rightsButton.ToolTip = CreaSoft.CommonServices.ResourceHelpers.GetGlobalResourceObject("FileExplorerControl.DirectoryRights");
rightsButton.Value = "ManageRightsFolder";
rightsButton.CommandName = "ManageRightsFolder";
 
Explorer.ToolBar.Items.Add(rightsButton);

 

Then I found it doesn't work as expected. Seems that icons are missing (ok, I didn't define any, but found now way how to do it), but based on html, it generates tooltip as css class :-) 

Then I found some strange code in Telerik_UI_for_ASP.NET_AJAX_2018_3_910_Source\Telerik.Web.UI\FileExplorer\RadFileExplorer.cs.

private void ConfigureToolbarButtons()
{
    bool isClassicMode = RenderMode == UI.RenderMode.Classic;
 
    if (!isClassicMode)
    {
        _toolbar.EnableImageSprites = true;
    }
 
    string icn = "icn";
    foreach (RadToolBarItem button in _toolbar.Items)
    {
        bool hasText = !String.IsNullOrEmpty(button.Text) && button.Text != Nbsp;
        string iconCssClass = String.Concat(icn, button.ToolTip);
        if (isClassicMode)
        {
            button.CssClass += hasText ? string.Empty : " rtbIconOnly ";
            button.CssClass += iconCssClass;
        }
        else
        {
            button.ShowText = hasText ? ToolBarShowPosition.Toolbar : ToolBarShowPosition.OverFlow;
            button.SpriteCssClass = iconCssClass;
        }
    }
}

 

So it seems to be a bug in this method. Css class should not be generated from Tooltip :-)

Please see attachments.

 

4 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 17 Dec 2018, 09:04 AM
Hi Raptor,

Thanks a lot for bringing this issue to our attention. I can verify that this is a bug int he control and we will look at it as soon as possible. Meanwhile, you can workaround the behavior by appending a white space in the beginning of the tooltip, applying the desired CSS class through the CSSClass property:
rightsButton = new RadToolBarButton();
rightsButton.ToolTip = " " + CreaSoft.CommonServices.ResourceHelpers.GetGlobalResourceObject("FileExplorerControl.DirectoryRights");
rightsButton.CssClass = "ManageRightsFolder";
rightsButton.Value = "ManageRightsFolder";
rightsButton.CommandName = "ManageRightsFolder";

I have also updated your Telerik points accordingly.

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
chainhome
Top achievements
Rank 1
answered on 25 Dec 2019, 08:12 AM
It also happened with 2019 R3 version. (2019.3.917)
0
Rumen
Telerik team
answered on 27 Dec 2019, 12:38 AM

Hi Chainhome,

Affirmative that the problem still persists in the latest version. Since you are the second to report it, I raised the priority of the issue and we will try to fix it for the upcoming R1 2020 release, due in mid-January.

On a side note, the workaround provided by Vessy is still applicable and up-to-date.

 

Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Rumen
Telerik team
answered on 09 Jan 2020, 03:09 PM

Update: The problem will be fixed in the R1 2020 release.

The Custom Button icon class will be taken from the Button's Value property.

Another improvement will be the bug fix: SpriteCssClass is not rendered in the RadToolBarButton.

Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
FileExplorer
Asked by
René
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Vessy
Telerik team
chainhome
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or