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

Treeview node text is not displaying

1 Answer 152 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
subrahmanyam kameswara
Top achievements
Rank 1
subrahmanyam kameswara asked on 06 May 2010, 02:47 PM

Hi,

When I am using node template in treeview the text of that treeview is not displaying at rum time.

could any one plz help me here is the code.

<telerik:RadTreeView runat="server" ID="RadTreeView1" Skin="Outlook">
            <Nodes>
                <telerik:RadTreeNode Text="POLICY" Expanded="true">
                    <Nodes>
                        <telerik:RadTreeNode Text="Policy Information">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Applicants">
                            <NodeTemplate>                             
                                <table id="tblApplicants" style="display: block; border: 0; width: 265px">
                                    <tr>
                                        <td>
                                            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                                                <asp:XmlDataSource ID="XmlApplicant" runat="server" DataFile="~/XMLs/EntitiesInfo.xml"
                                                    XPath="/Entities/EntityInfo"></asp:XmlDataSource>
                                                <telerik:RadGrid ID="radGVApplicant" runat="server" Width="265px" AllowPaging="True"
                                                    PageSize="2" AutoGenerateColumns="False" Skin="Default" GridLines="None" FooterStyle-CssClass="GVHdrColor"
                                                    SelectedItemStyle-CssClass="GvRead" CommandItemStyle-Wrap="true" DataSourceID="XmlApplicant"
                                                    PagerStyle-AlwaysVisible="true">
                                                    <SelectedItemStyle CssClass="MySelectedClass" />
                                                    <MasterTableView CommandItemDisplay="None" SkinID="GVHeadrColor">
                                                        <NoRecordsTemplate>
                                                            <div>
                                                                No records found.
                                                            </div>
                                                        </NoRecordsTemplate>
                                                        <AlternatingItemStyle CssClass="MyRowClass" />
                                                        <HeaderStyle CssClass="grdHdr" />
                                                        <ItemStyle CssClass="grdItem" />
                                                        <FooterStyle CssClass="grdPager" />
                                                        <Columns>
                                                            <telerik:GridTemplateColumn DataField="CrsID" HeaderText="#" HeaderStyle-Width="5%"
                                                                HeaderStyle-CssClass="grdHdr" ItemStyle-CssClass="grdItem" FooterStyle-CssClass="grdPager">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblSno" runat="server" Text='<%# XPath("SNo") %>' SkinID="GridLbl"></asp:Label>
                                                                </ItemTemplate>
                                                            </telerik:GridTemplateColumn>
                                                            <telerik:GridTemplateColumn DataField="Name" HeaderText="Name" HeaderStyle-Width="45%"
                                                                UniqueName="Name" HeaderStyle-CssClass="grdHdr" ItemStyle-CssClass="grdItem"
                                                                FooterStyle-CssClass="grdPager">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblAppName" runat="server" Text='<%# XPath("Name") %>' SkinID="GridLbl"></asp:Label>
                                                                </ItemTemplate>
                                                            </telerik:GridTemplateColumn>
                                                            <telerik:GridButtonColumn HeaderStyle-Width="5%" HeaderStyle-CssClass="grdHdrDel"
                                                                ItemStyle-CssClass="grdItemDel" FooterStyle-CssClass="grdPager" ButtonType="ImageButton"
                                                                HeaderText="Delete" ImageUrl="../Images/deleteicon_disabled.gif" ConfirmDialogType="RadWindow"
                                                                ConfirmText="Are you sure want to delete Applicant?">
                                                            </telerik:GridButtonColumn>
                                                        </Columns>
                                                    </MasterTableView>
                                                    <ClientSettings EnablePostBackOnRowClick="true">
                                                        <Selecting AllowRowSelect="true" />
                                                        <Scrolling AllowScroll="false" />
                                                       
                                                    </ClientSettings>
                                                </telerik:RadGrid>
                                            </telerik:RadAjaxPanel>
                                        </td>
                                    </tr>
                                </table>
                            </NodeTemplate>
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Primary Address"></telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Mailing Address"></telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Underwriter Questions"></telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Worker's Comp. Policy Information"></telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeView>

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 07 May 2010, 03:39 PM
Hi subrahmanyam kameswara,

As difference to the RadPanelBar, the templates in the RadTreeView, e.g. the NodeTemplate-s are completely removing the default template. For example, if you create an ItemTemplate for PanelBar's items the Text property of the items will still be shown, but in the TreeView the NodeTemplate completely replaces the default layout.

In order to show the Text property of the nodes, you should use the following in your NodeTemplate:
<NodeTemplate>
    <asp:Label Text='<%# DataBinder.Eval(Container, "Text") %>' />
    /// ...
    /// Here goes the rest of the template
</NodeTemplate>

With this additional line the text property will be added to the layout of all of your nodes.

Hope this will help you!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
subrahmanyam kameswara
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or