in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Limit the users in creating nodes upto certain level

Last post 11/14/2008 12:53 PM by Manish Shakya. 2 replies.
Page 1 of 1 (3 items)
Sort Posts:
Previous Next
  • 10/29/2008 2:28 PM

    Limit the users in creating nodes upto certain level

    I got a couple of question

    how can we control the child node creation ASPxTreeList
    For example:

    Node A
         1
            Node 1
                 11
                12
                13

                Node 11
                    Node11 1
                    Node11 2
                    Node11 3
                    Node11 4
                    Node11 5
                    Node11 6
                    Node11 7
                    Node11 8
                    Node11 9
                    Node11 10
                
        2
        3
        4
        5
        
            For Root Node Child Nodes are 5 (1 2 3 4 5 )
            For Root Node 1 Child Nodes are 3 (11 12 13 )
            For Root Node 11 Child Nodes are 10 (11 1.....11 10)

    How to force user to create child only as mentioned above.
    Is there any way we can do this.
    Thanks

     

    Filed under:
  • 11/9/2008 1:15 PM In reply to

    Re: Limit the users in creating nodes upto certain level

     Hi,

    You can handle the InitNewNode event.

    Example:

    protected void ASPxTreeList1_InitNewNode(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) {

        int newNodeLevel = ASPxTreeList1.FindNodeByKeyValue(ASPxTreeList1.NewNodeParentKey).Level + 1;

        if (newNodeLevel > 2) ASPxTreeList1.CancelEdit();

    }

     

    Thanks, Nathan.
    R&D, .NET Team, Developer Express Inc.
    P.S. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/Support/Center
  • 11/14/2008 12:53 PM In reply to

    Re: Limit the users in creating nodes upto certain level

    I am successfully able to work with the code you showed.Thank you much, now i need to show and hide the command buttons in some nodes.(Hide) only if they are not you cannot not add or edit else show.

    For example:
    Node A *Do not Show (Edit New Delete) Command Buttons
         1 *Show (Edit New Delete) Buttons
            Node 1 *Do not Show (Edit New Delete) Command Buttons
                 11*Show (Edit New Delete) Command Buttons
                 12 *Do not Show (Edit New Delete) Command Buttons
                 13*Do not Show (Edit New Delete) Command Buttons

                Node 11
                    Node11 1 *Do not Show (Edit New Delete) Command Buttons
                    Node11 2*Do not Show (Edit New Delete) Command Buttons
                    Node11 3 *Do not Show (Edit New Delete) Command Buttons
                    Node11 4*Do not Show (Edit New Delete) Command Buttons
                    Node11 5*Do not Show (Edit New Delete) Command Buttons
                    Node11 6*Do not Show (Edit New Delete) Command Buttons
                    Node11 7*Do not Show (Edit New Delete) Command Buttons
                    Node11 8*Do not Show (Edit New Delete) Command Buttons
                    Node11 9*Do not Show (Edit New Delete) Command Buttons
                    Node11 10*Do not Show (Edit New Delete) Command Buttons
                   
    In addtion
    I would like to allow user's only upto 10 Nodes to be added in Node 11 if he tries to add new add paging show page 1
    at the end and show edit textboxes in page 2

     Node 11
                    Node11 11 *Do not Show (Edit New Delete) Command Buttons
                    .
                    .
                    .
                    .
                    .
                    .
                    .
                    .
                    Node11 20*Do not Show (Edit New Delete) Command Buttons
                [1]2

    Where Page 1 will hold Node 11- 1.....11-10

    Page 2 will holds 11-11 - 11- 20

    ..

    To Page N

    Thanks

    Filed under:
Page 1 of 1 (3 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED