Customizing CommandItem table

6 posts, 0 answers
  1. John John
    John John avatar
    132 posts
    Member since:
    Aug 2009

    Posted 23 Feb 2010 Link to this post


            Is there any possibility to customize CommandItemTable and add one more button in addition to AddNewRecord and Refresh button.


    I would like to add one Export button in the CommandItem row or in between Add and Refresh button. So please le me know the availability of this option.




  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2010 Link to this post

    Hi John,

    By setting CommandItemSettings-ShowExportToExcelButton to True, you can show the default button for exporting, which is in CommandItem.
              <CommandItemSettings ShowExportToExcelButton="true" />

    Another option is using CommandItemTemplate to customize the CommandItem in grid. In the CommandItemTemplate you can add any type of buttons that rise command event and Telerik RadGrid will fire the ItemCommand event on the server when this button is clicked.

  3. OverCoded
    OverCoded avatar
    34 posts
    Member since:
    Mar 2010

    Posted 01 Sep 2011 Link to this post

    Using the CommandItemTemplate  clears the default layout. I like the way it looks and would like to add a textbox with button to seach the data in the grid data source. If using the template is the only way to customize do you have the code to we could see to make it look like yours does with the refresh and export buttons including the sprites and the css files?
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Sep 2011 Link to this post


    The command item content can be customized using the template of a GridTableView.CommandItemTemplate. You cannot exactly have the same look and feel of default CommandItemDisplay.

  5. Kiara
    Kiara avatar
    309 posts
    Member since:
    Jul 2006

    Posted 02 Sep 2011 Link to this post

    Unless you make your customized CommandItemTemplate look quite the same in appearance (colors, text font and sizes of the buttons, etc.) as the default one, of course.

  6. OverCoded
    OverCoded avatar
    34 posts
    Member since:
    Mar 2010

    Posted 02 Sep 2011 Link to this post

    Thank you for your quick response. Actually I was able to find a partial solution on another post that gave me enough information to replicate the default look to my satisfaction. Here it is:
    <table border="0" style="width: 100%;" class="rgCommandTable"
        <td align="left"
        <asp:Button CommandName="InitInsert" runat="server" ID="btnAddNewRecord" Text=" " 
                    title="Add new record" CssClass="rgAdd" /> 
        <asp:LinkButton ID="lnkbAddNewRecord" CommandName="InitInsert" runat="server">
                Submit HCAR</asp:LinkButton
         //My code here. just a cell with a textbox and a search button. 
        <td align="left" valign="middle">
        <asp:TextBox runat="server" ID="tb_searchItem" Text="Enter HCAR Number" />
        <asp:Button runat="server" CssClass="rgSearch" CommandName="search" Text=" " />
         //End of my code... 
        <td align="right">                                     
        <asp:Button CommandName="RebindGrid" runat="server" ID="btnRefresh" Text=" "
                title="Refresh" CssClass="rgRefresh" /> 
        <asp:LinkButton ID="lnkbRefresh" CommandName="RebindGrid" runat="server">Refresh</asp:LinkButton
        <asp:Label runat="server" Text="|" />
        <asp:Button ID="expbexcel" CommandName="ExportToExcel" CssClass="rgExpXLS" runat="server" />
        <asp:Button ID="expbdoc" CommandName="ExportToWord" CssClass="rgExpDOC" runat="server" />
        <asp:Button ID="expbpdf" CommandName="ExportToPdf" CssClass="rgExpPDF" runat="server" />
        <asp:Button ID="expbcsv" CommandName="ExportToCsv" CssClass="rgExpCSV" runat="server" />
Back to Top