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

Customizing CommandItem table

5 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John John
Top achievements
Rank 1
John John asked on 23 Feb 2010, 08:24 AM

Hi,

        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.

 

-Thanks

 

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Feb 2010, 09:21 AM
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.

-Shinu.
0
OverCoded
Top achievements
Rank 2
answered on 01 Sep 2011, 09:01 PM
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?
0
Shinu
Top achievements
Rank 2
answered on 02 Sep 2011, 07:50 AM
Hello,

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.

Thanks,
Shinu.
0
Kiara
Top achievements
Rank 1
answered on 02 Sep 2011, 08:34 AM
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.

Kiara
0
OverCoded
Top achievements
Rank 2
answered on 02 Sep 2011, 04:59 PM
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:
<CommandItemTemplate
<table border="0" style="width: 100%;" class="rgCommandTable"
<tr
    <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
    </td
     //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=" " />
    </td>
     //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" />
     </td
  </tr
</table
</CommandItemTemplate>
Tags
Grid
Asked by
John John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
OverCoded
Top achievements
Rank 2
Kiara
Top achievements
Rank 1
Share this question
or