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

Tree.CheckedNodes.Count always 0

1 Answer 97 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
-DJ-
Top achievements
Rank 1
-DJ- asked on 12 Jun 2008, 02:22 PM
*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.



Hi,

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?

-DJ-

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 16 Jun 2008, 01:11 PM
Hi,

I tried the following code and everything is OK.
ASPX:
<html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%">  
<head id="Head1">  
    <title>Untitled Page</title> 
</head> 
<body style="height: 100%">  
    <form id="form1" runat="server" style="height: 100%">  
        <div> 
            <asp:ScriptManager ID="ScriptManager1" runat="server">  
            </asp:ScriptManager> 
            <div> 
                <telerik:RadDockLayout ID="RadDockLayout1" runat="server">  
                    
                            <telerik:RadDockZone ID="RadDockZone1" runat="server">  
                                <telerik:RadDock ID="RadDock1" runat="server" Width="150px" AutoPostBack="true" Resizable="true">  
                                    <ContentTemplate> 
                                        <telerik:RadComboBox ID="RadCombobox1" runat="server">  
                                            <Items> 
                                                <telerik:RadComboBoxItem runat="server" /> 
                                            </Items> 
                                            <ItemTemplate> 
                                                <telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="true">  
                                                    <Nodes> 
                                                        <telerik:RadTreeNode Text="1"></telerik:RadTreeNode> 
                                                        <telerik:RadTreeNode Text="2"></telerik:RadTreeNode> 
                                                        <telerik:RadTreeNode Text="3"></telerik:RadTreeNode> 
                                                    </Nodes> 
                                                </telerik:RadTreeView> 
                                            </ItemTemplate> 
                                        </telerik:RadComboBox> 
                                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" /> 
                                    </ContentTemplate> 
                                </telerik:RadDock> 
                            </telerik:RadDockZone> 
                            <telerik:RadDockZone ID="RadDockZone2" runat="server">  
                            </telerik:RadDockZone> 
                      
                </telerik:RadDockLayout> 
                <asp:Button ID="btnPostback" runat="server" Text="Postback" /> 
            </div> 
    </form> 
</body> 
</html> 
 
CodeBehind:
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
Tags
TreeView
Asked by
-DJ-
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Share this question
or