Grey out Custom toolbar control

2 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    9 posts
    Member since:
    Mar 2013

    Posted 21 Mar 2014 Link to this post

    I have created a custom toolbar button for download, everything is working fine, now I would lke to know how can we greyed out the custom button when no file is selected.

    Just like delete button gets greyed out when no file is selected.

  2. Ianko
    Ianko avatar
    1914 posts

    Posted 25 Mar 2014 Link to this post

    Hello Muhammad,

    The logic for enabling and disabling on desired flag should be further implemented. There is no built-in functionality that exposes available approach for such mater. Note that you should handle this on each event that is changing the path of the Explorer (e.g. OnClientItemSelected).

    The following is just an example for how to implement a logic that disables or enables the custom button according to the item's Delete permission:

    <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1"
                <Configuration ViewPaths="~/Images" DeletePaths="~/Images/Folder1" />
    <script type="text/javascript">
        function toolbarClicked(toolbar, args) {
            var buttonValue = args.get_item().get_value();
            if (buttonValue == "testCommand")
                alert("test button clicked");
        function attachHandlers(explorer, args) {
            var toolbar = explorer.get_toolbar();
            setButtonEnableState(explorer, explorer.get_selectedItem().get_permissions(), "testCommand");
        function OnClientItemSelected(explorer, args) {
            setButtonEnableState(explorer, args.get_item().get_permissions(), "testCommand");
        function OnClientFolderChange(explorer, args) {
            setButtonEnableState(explorer, args.get_item().get_permissions(), "testCommand");
        function setButtonEnableState(explorer, curDirPermissions, command) {
            var permissions = Telerik.Web.UI.FileExplorerItemPermissions;
            if (typeof (curDirPermissions) == 'undefined' || curDirPermissions == null)
                curDirPermissions = explorer.get_currentPermissions();
            var button = explorer.get_toolbar().findItemByValue(command);
            button.set_enabled((curDirPermissions & permissions.Delete) != 0);

    protected void Page_Load(object sender, EventArgs e)
        RadToolBarButton customButton = new RadToolBarButton("test");
        customButton.CssClass = "test_button";
        customButton.Value = "testCommand";


    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

Back to Top