How to save only childnode.

2 posts, 0 answers
  1. Tuong Lan (FIS Soft)
    Tuong Lan (FIS Soft) avatar
    1 posts
    Member since:
    Oct 2010

    Posted 25 Apr 2011 Link to this post

    I have a treeview (see attach file )
    I want to save four nodes like circle.
    I only save success node: Community. I cann't save three nodes: Development, Product, Operation.
    Here is code to save:
    List<RadTreeNode> checkedNodes = this.trvHierarchy.CheckedNodes.ToList<RadTreeNode>();
    List<string> lstJobNode = new List<string>();
     foreach (RadTreeNode node in checkedNodes)
           if (string.IsNullOrEmpty(node.Value) == false
           && node.CheckState == TreeNodeCheckState.Checked)
                     RadTreeNode parentNode = node.ParentNode;
    //Only save parent. Don not save child if parent is checked.
                     if (parentNode == null || parentNode.CheckState != TreeNodeCheckState.Checked)
  2. Kate
    Kate avatar
    1898 posts

    Posted 28 Apr 2011 Link to this post

    Hi Tuong Lan (FIS Soft),

    Please make sure that the logic in the code behind that you have pasted is what you need to achieve. As I see, you intend to save only parent nodes whose checkboxes are checked.
    if (string.IsNullOrEmpty(node.Value) == false
           && node.CheckState == TreeNodeCheckState.Checked)

    However, in the screenshot that you attached, the items that you intended to save are not checked, therefore you are not able to save them. Try to check them (the parent nodes) and see if this works. 

    Kind regards,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top