|
| 1 | +--- |
| 2 | +title: Command Item |
| 3 | +page_title: Command Item | RadTreeList for ASP.NET AJAX Documentation |
| 4 | +description: Command Item |
| 5 | +slug: treelist/items/command-item |
| 6 | +tags: command,item,export |
| 7 | +published: True |
| 8 | +position: 2 |
| 9 | +--- |
| 10 | + |
| 11 | +# Command Item |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +Since R2 2016 the **RadTreeList** control provides **CommandItem**. The CommandItem is a placeholder for commands that can perform some action on the selected/all items.See the [Command reference](http://docs.telerik.com/devtools/aspnet-ajax/controls/treelist/control-lifecycle/command-reference.html ) topic for details about the available commands. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +To enable the command item you must set **CommandItemDisplay="DesiredPosition"** that accepts the following values: Top, Bottom, TopAndBottom, and None (default). |
| 20 | +There is a declarative **CommandItemStyle** added to the TreeList control. It can be used for simple decoration purposes. |
| 21 | + |
| 22 | +The [ExportToPdf], [ExportToWord] and [ExportToExcel] buttons will be automatically placed in a command item (**TreeListCommandItem**). If you need to access them server-side you have to know their IDs: |
| 23 | + |
| 24 | +* **ExportToPdf -** ExportToPdf html button |
| 25 | + |
| 26 | +* **ExportToWord -** ExportToWord html button |
| 27 | + |
| 28 | +* **ExportToExcel -** ExportToExcel html button |
| 29 | + |
| 30 | +All tooltips can be configured through the associated **CommandItemSettings**. Also you can toggle the visibility of the export buttons through the **CommandItemSettings** |
| 31 | + |
| 32 | +````ASP.NET |
| 33 | +<telerik:RadTreeList RenderMode="Lightweight" runat="server" Width="700px" Skin="Material" ID="RadTreeList1" CommandItemDisplay="Top" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" AllowPaging="true" PageSize="5" DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo"> |
| 34 | + <CommandItemSettings ExportToExcelText="Export Button1" ShowExportToPdfButton="false" /> |
| 35 | + <CommandItemStyle BackColor="#FFC0C0" BorderColor="#FFE0C0" BorderStyle="Dotted" |
| 36 | + BorderWidth="1px" Font-Bold="True" Font-Italic="True" Font-Names="Arial Black" |
| 37 | + Font-Overline="True" Font-Size="Small" Font-Strikeout="True" Font-Underline="True" |
| 38 | + ForeColor="#404040" Height="40px" HorizontalAlign="Left" VerticalAlign="Middle" |
| 39 | + Width="800px" Wrap="True" /> |
| 40 | + <Columns> |
| 41 | + <telerik:TreeListBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID"> |
| 42 | + </telerik:TreeListBoundColumn> |
| 43 | + <telerik:TreeListBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="LastName"> |
| 44 | + </telerik:TreeListBoundColumn> |
| 45 | + <telerik:TreeListBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="FirstName"> |
| 46 | + </telerik:TreeListBoundColumn> |
| 47 | + <telerik:TreeListBoundColumn DataField="Title" HeaderText="Title" UniqueName="Title"> |
| 48 | + </telerik:TreeListBoundColumn> |
| 49 | + <telerik:TreeListBoundColumn DataField="ReportsTo" HeaderText="ReportsTo" UniqueName="ReportsTo"> |
| 50 | + </telerik:TreeListBoundColumn> |
| 51 | + </Columns> |
| 52 | + </telerik:RadTreeList> |
| 53 | + <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT EmployeeID, LastName, FirstName, Title, ReportsTo FROM Employees" runat="server"></asp:SqlDataSource> |
| 54 | +```` |
| 55 | +# Command Item in Mobile Render Mode |
| 56 | + |
| 57 | +The command item rendering in mobile mode is different and it is not located in the table rows |
| 58 | +Because of the reason above, CommandItemStyle won't have any effect on the rendering and the CommandItem (row) will not be added to the table rows. |
| 59 | +The default value is TreeListCommandItemDisplay is set to Top if either AllowColumnHide or AllowColumnReorder are enabled. Otherwise the default value is TreeListCommandItemDisplay is None |
| 60 | + |
| 61 | +The animation below demonstrates the CommandItem functionality in Mobile RenderMode: |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
0 commit comments