Disable ToolBarButton - TopandBottom CommandItemDisplay

2 posts, 1 answers
  1. Keith
    Keith avatar
    23 posts
    Member since:
    Jan 2013

    Posted 13 Oct 2016 Link to this post

    I have a RadToolBar in the CommandItemTemplate of a RadGrid.  I would like to (client-side) disable a button upon row click.  On row click I loop through the tool bar's items and disable the button I want.  This works but only disables the button on the top of the grid.  The command items at the bottom of the grid are left alone.  How can I disable both the top and bottom button?

     

    function grdViewToolRecords_RowClicked(sender, args) {
        var toolBar = $telerik.findControl(sender.get_element(), "rtbViewToolRecords");
        var toolBarItems = toolBar.get_allItems();
     
        var i = 0;
     
        while (i < toolBarItems.length) {
            if (toolBarItems[i].get_text() == "Check Out") {
                toolBarItems[i].disable();
            }
     
            i++;
        }
     
        toolBar.commitChanges();
    }
  2. Answer
    Eyup
    Admin
    Eyup avatar
    3175 posts

    Posted 18 Oct 2016 Link to this post

    Hello Keith,

    You should access both of the CommandItems to achieve this requirement. For example:
    $.each($(sender.get_element()).find(".rgCommandRow"), function (i, el) {
        var control = $telerik.findControl(el, "RadButton1");
        alert(control.get_id());
    });

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik by Progress
    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