Tree.CheckedNodes.Count always 0

2 posts, 0 answers
  1. -DJ-
    -DJ- avatar
    263 posts
    Member since:
    Oct 2004

    Posted 12 Jun 2008 Link to this post

    *edit 2* It's not so moot after all.
    It has everything to do with he dock. (Should I move this topic there?)

    If I remove the enableviewstate="false"  from the DockLayout, the treeview works correctly. But instead I lose my custom dockcommand functionality (adding and removing items on the fly).

    Feels like I'm stuck in a catch 22...

    *edit* This is a moot point, I figured it out.

    I was rebinding the treeview after postback. Not sure why it interfered with an event that is executed before (right?), but it did.

    In any case it had nothing to do with the dock as I first thought.


    I have a treeview inside a combobox, inside a dock. The treeview has checkboxes and no events fire when selecting the boxes.

    Once you have selected all checkboxes your heart desires, you click a button which then writes the values of the boxes to a cookie.

    However Tree.CheckedNodes.Count is always 0, doesn't matter which or how many checkboxes you check.

    I'm using the exact same setup, a treeview within a combobox, but outside of the docks in that same project where it works fine.

    I've verified that the event is fired, it's just that for some reason the checked nodes aren't checked... it seems, and I'm having a hard time figuring out why that is.

    Any thoughts?

  2. Petio Petkov
    Petio Petkov avatar
    825 posts

    Posted 16 Jun 2008 Link to this post


    I tried the following code and everything is OK.
    <html xmlns="" style="height: 100%">  
    <head id="Head1">  
        <title>Untitled Page</title> 
    <body style="height: 100%">  
        <form id="form1" runat="server" style="height: 100%">  
                <asp:ScriptManager ID="ScriptManager1" runat="server">  
                    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">  
                                <telerik:RadDockZone ID="RadDockZone1" runat="server">  
                                    <telerik:RadDock ID="RadDock1" runat="server" Width="150px" AutoPostBack="true" Resizable="true">  
                                            <telerik:RadComboBox ID="RadCombobox1" runat="server">  
                                                    <telerik:RadComboBoxItem runat="server" /> 
                                                    <telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="true">  
                                                            <telerik:RadTreeNode Text="1"></telerik:RadTreeNode> 
                                                            <telerik:RadTreeNode Text="2"></telerik:RadTreeNode> 
                                                            <telerik:RadTreeNode Text="3"></telerik:RadTreeNode> 
                                            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" /> 
                                <telerik:RadDockZone ID="RadDockZone2" runat="server">  
                    <asp:Button ID="btnPostback" runat="server" Text="Postback" /> 
    protected void Button1_Click(object sender, EventArgs e)  
            int nodesCount = ((RadTreeView)RadCombobox1.Items[0].FindControl("RadTreeView1")).Nodes.Count;  
            RadDock1.Title = nodesCount.ToString();  
    Keep in mind that if you create RadDock dynamically you should do it in the Init event of the page.

    If you think that the problem is related to RadControls itself, please open a new support thread and send us a simple running project, where we can observe this issue. Once we receive it, we will do our best to help you.

    Best wishes,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
Back to Top