CheckBoxList within NodeTemplate

4 posts, 0 answers
  1. Stephen
    Stephen avatar
    158 posts
    Member since:
    Jan 2009

    Posted 28 Mar 2013 Link to this post

    I'm trying to do something that I think shold be simple but it doesn't seem to be working.  I have the TreeView set with a datasource to build out one level of nodes.  Within each of those nodes I want a CheckBoxList which uses another datasource.  When I do this though the CheckBoxList doesn't show up at all.  Do I need to go about this another way?

    <telerik:RadTreeView ID="rtvCapabilities" runat="server" CheckBoxes="false" DataSourceID="odsCapabilityList" DataTextField="Capability_ID" DataValueField="Capability_ID">
       <Nodes>
           <telerik:RadTreeNode>
               <NodeTemplate>
                   <asp:CheckBoxList ID="cblExpertise" runat="server" RepeatColumns="3" RepeatDirection="Vertical" DataSourceID="odsWSExpertiseList" DataTextField="Description" DataValueField="ID" />
               </NodeTemplate>
           </telerik:RadTreeNode>
       </Nodes>
    </telerik:RadTreeView>
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 29 Mar 2013 Link to this post

    Hello Stephen,

    Please try using the approach described in this help article Adding and Editing Templates at Runtime.

    Greetings,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stephen
    Stephen avatar
    158 posts
    Member since:
    Jan 2009

    Posted 29 Mar 2013 Link to this post

    Thanks for the reply.  I took a look at that and it helps but the problem is that  I have a datasource for my main nodes and under each node I want the CheckBoxList.  If I try to set a datasource in the PageLoad instead of harcoding the nodes it doesn't work and it just makes the CheckBoxList the parent node...unless of course I am doing something wrong.

    I have a list of Capabilities in the database and a list of Expertise.  Basically I want the tree nodes to be the Capabilities and each Capability should have a CheckBoxList which is populated by the list of Expertise.

    So do I have to do all of this in the codebehind?  If so how do I set the datasource of the nodes to be the Capabilities and then have the CheckBoxList under each node?
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 03 Apr 2013 Link to this post

    Hello Stephen,

    To be able to apply different templates (or no templates) on the different levels of the nodes it is recommended that you use code behind. Attached to this post you can find a very simplified runnable page that demonstrates how this can be done. Please use the example as a base to implement the desired control in the template and extend it as desired. 

    Greetings,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top