Getting the Root node

2 posts, 0 answers
  1. Tejas Kan
    Tejas Kan avatar
    6 posts
    Member since:
    Oct 2009

    Posted 28 Aug 2011 Link to this post

    Hi
    I have the following telerik:RadTreeList 

    <telerik:RadTreeList ID="RadTreeListFacility" runat="server" DataKeyNames="Key" ParentDataKeyNames="SuperiorFacilityID"
            AutoGenerateColumns="False" Width="100%" AllowMultiItemEdit="False" Culture="(Default)"
            OnNeedDataSource="RadTreeListFacility_NeedDataSource">
            <Columns>
                <telerik:TreeListSelectColumn UniqueName="SelectColumn" Visible="false" />
                <telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" HeaderText="Display Name" />
                <telerik:TreeListBoundColumn DataField="Key" UniqueName="Key" HeaderText="Unique ID" />
                <telerik:TreeListBoundColumn DataField="FacilityType" UniqueName="FacilityType" HeaderText="Type" />
                <telerik:TreeListBoundColumn DataField="SuperiorFacilityID" UniqueName="SuperiorFacilityID"
                    HeaderText="Parent ID" Visible="false" />
                <telerik:TreeListTemplateColumn ItemStyle-Width="100px" HeaderStyle-Width="100px">
                    <HeaderTemplate>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <span onclick="Edit_OnClick({Key:'<%# Eval("Key") %>',Name:'<%# Eval("Name")%>',SID:'<%# Eval("SuperiorFacilityID")%>',Type:'<%# Eval("FacilityType")%>'});">
                            <img src="../../images/DataEditing/Edit.gif" title="Update Selected Clinic" alt="Update Selected Clinic" />
                        </span>
                        <span onclick="AddSubFacility_OnClick({SID:'<%# Eval("Key")%>'});">
                            <img src="../../images/DataEditing/AddRecord.gif" title="Add Below Selected Clinic"
                                alt="Add Below Selected Clinic" />
                        </span>
                        <span onclick="Delete_OnClick({Key:'<%# Eval("Key") %>',Name:'<%# Eval("Name")%>'});">
                            <img src="../../images/DataEditing/Delete.gif" title="Delete Selected Clinic" alt="Delete Selected Clinic" />
                        </span>
                    </ItemTemplate>
                </telerik:TreeListTemplateColumn>
            </Columns>
            <ClientSettings AllowPostBackOnItemClick="false">
                <Selecting AllowItemSelection="true" AllowToggleSelection="true" />
            </ClientSettings>
        </telerik:RadTreeList>


    This tree has only one root node element.
    Using Javascript I want to get hold of the Root element.
    I have tried
    var tree = $find("<%= RadTreeListFacility.ClientID %>");
    var node0 = tree.get_nodes().getNode(0);


    This dose not work


    Also I would like to know how to get values the Key and the Name DataField values of the root node client side. Thanks in advance. Tejas
  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 31 Aug 2011 Link to this post

    Hi Tejas,

    I would advise you to take a look at the treelist client API articles in order to see which properties and methods you need. More specifically for your scenario:
    get_dataItems
    get_dataKeyValue
    Getting Familiar with RadTreeList Client-Side API

    Kind regards,
    Tsvetina
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top