Save changes to treeview not working for me

1 posts, 0 answers
  1. Ciaran
    Ciaran avatar
    1 posts
    Member since:
    Feb 2013

    Posted 07 Feb 2013 Link to this post

    I'm populating a treeview in c# and have bound data to it, all well and displays as it should. my problem now is that i'm looking to save any modifications to the checkboxes i.e if a user clicks an additional box and saves but i the checked state will stay false.

    here's what i have so far which iterates through what was initially loaded and not what has been changed, I've tried many variations but haven't managed to get it working - anyone any ideas??

    public void saveCheckedItems()
        if (treeListItems.CheckedNodes.Count > 0)
            IList<RadTreeNode> allNodes = treeListItems.GetAllNodes();
            for (int i = 0; i < allNodes.Count; i++)
                RadTreeNode node = (RadTreeNode)allNodes[i];
                string fileid = node.Value.ToString();
                if (node.Checked == true)
                    if (fileid.Length == 12)
                        saveTreeChanges(Page.Request.QueryString["ID"], fileid,connectionStr);

    edit -

    creating treeview as follows

    <telerik:RadTreeView ID="treeListItems" runat="server" CheckBoxes="True" Height="320px"
                                TriStateCheckBoxes="true" CheckChildNodes="true" Skin="WebBlue" CssClass="table table-bordered" OnNodeDataBound="RadTreeView1_NodeDataBound" >

    binding data like this

    public void loadTreeList()
                DataTable dt = treeMan.getTreeList(connectionStr);
                treeListItems.DataTextField = "Description";
                treeListItems.DataValueField = "FieldID";
                treeListItems.DataFieldID = "FieldID";
                treeListItems.DataFieldParentID = "ParentID";
                treeListItems.DataSource = dt;

    in the example im testing its a 3 tier tree and one element is checked on third tier. When i click more items only this already checked item is visible in the list

Back to Top