Skip to main content

How to: Create Templates

  • 2 minutes to read

This example demonstrates how you can create templates.

View Example

<dx:ASPxTreeView ID="ASPxTreeView1" runat="server" Width="386px" Height="354px">
    <NodeTextTemplate>
          <b><%# Eval("Text") %></b>
          <br><%# Eval("Name") %>
    </NodeTextTemplate>
    <Nodes>
        <dx:TreeViewNode>
            <Nodes>
                <dx:TreeViewNode Name="ASPxHTMLEditor? Suite" Text="HTML Editor for ASP.NET">
                    <Image Url="~/Images/ASPxHtmlEditor.png">
                    </Image>
                </dx:TreeViewNode>
                <dx:TreeViewNode Name="ASPxMenu? " Text="Menu for ASP.NET">
                    <Image Url="~/Images/ASPxMenu.png">
                    </Image>
                </dx:TreeViewNode>
                <dx:TreeViewNode Name="ASPxEditors? Library" Text="Data Editors for ASP.NET">
                    <Image Url="~/Images/ASPxEditors.png">
                    </Image>
                </dx:TreeViewNode>
            </Nodes>
            <Template>
                <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="277px" ShowHeader="False" Font-Bold="True">
                    <PanelCollection>
                        <dx:PanelContent runat="server">
                            <table>
                               <tr>
                               <td style="height: 52px">
                                  <img src="Images/asp.png" />
                               <td style="height: 52px">
                                 <span style="font-size: 12pt;">
                                ASP.NET AJAX Controls</span>
                            </table></dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxRoundPanel>
           </Template>
        </dx:TreeViewNode>
        <dx:TreeViewNode>
            <Nodes>
                <dx:TreeViewNode Name="XtraGrid? Suite " Text="Grid and Data Editors for WinForms">
                    <Image Url="~/Images/XtraGrid.png">
                    </Image>
                </dx:TreeViewNode>
                <dx:TreeViewNode Name="XtraPivotGrid? Suite " Text="OLAP Data Mining Control for WinForms">
                    <Image Url="~/Images/XtraPivotGrid.png">
                    </Image>
                </dx:TreeViewNode>
                <dx:TreeViewNode Name="XtraTreeList? Suite " Text="TreeView-Grid Hybrid for WinForms">
                    <Image Url="~/Images/XtraTreeList.png">
                    </Image>
                </dx:TreeViewNode>
            </Nodes>
             <Template>
                <dx:ASPxRoundPanel ID="ASPxRoundPanel2" runat="server" Width="239px" ShowHeader="False" Font-Bold="True" Height="48px">
                    <PanelCollection>
                        <dx:PanelContent runat="server">
                            <table>
                               <tr>
                               <td style="height: 54px">
                                 <img src="Images/win.png" />
                               <td style="height: 54px">
                                 <span style="font-size: 12pt;">
                                 WinForms Controls </span>
                            </table></dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxRoundPanel>
            </Template>
        </dx:TreeViewNode>
    </Nodes>
    <Styles>
        <NodeImage>
            <Paddings Padding="2px" />
        </NodeImage>
    </Styles>
</dx:ASPxTreeView>
protected void Page_Load(object sender, EventArgs e) {
    ASPxTreeView1.ExpandAll();
}