RadGrid - Custom fire command with empty grid

2 posts, 0 answers
  1. MathieuB
    MathieuB avatar
    21 posts
    Member since:
    May 2013

    Posted 27 Mar 2019 Link to this post

    Hi,
        In my RadGrid, I have a Custom RadToolbar for implement my actions. Inside this toolbar I have a RadButton
    <telerik:RadToolBarButton   Text="<%$ Resources:AdminLoc, btnAddDailyEquipment %>"
    ImageUrl="~/Web/Images/Icons/ress_equipement.gif"
    Group="DailyEquipment" CommandName="AddDailyResource" CommandArgument="DailyEquipment"
    Value="DailyEquipment" Visible="<%# KeyValueTools.GetActivitekRepentignyDev %>">


    My  Toolbar implement the OnClientButtonClicked attribute who calling a JS function with this code
    case "AddDailyResource":<br> $find('<%= RgPanelSummary.ClientID%>').get_masterTableView().fireCommand(args.get_item().get_commandName(), argument);<br>        break;


    If I have more than one element in my grid. The server-side ItemCommand is fired

    But my problem occuring when I have no data in my RadGrid. The server-side called the ItemDataBound (RadGrid), the PageLoad, PageRender, etc. But the ItemCommand is never called. I have this problem for each custom action "Print, DailyEquipement". But If I using a default Radgrid action (DeletedSelected, InitInsert) the ItemCommand is called.

    Can I resolve my problem? And If Yes how ?
    Thank you and have a good day



  2. Eyup
    Admin
    Eyup avatar
    4073 posts

    Posted 01 Apr 2019 Link to this post

    Hi Mathieu,

    Yes, this is correct and mentioned in the following article:
    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridtableview-object/methods/firecommand

    You can use hidden button to call its .click() method or implement your own _doPostback to achieve this requirement when the grid has no items.

    Regards,
    Eyup
    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.
Back to Top