How to make parent node readonly ?

2 posts, 0 answers
  1. Neha
    Neha avatar
    21 posts
    Member since:
    Jan 2011

    Posted 01 Mar 2011 Link to this post

    Hi,

    I have Tree View with three parent node. I wanted to use parent node just as title for those Child Nodes. User can't select it or no operation should happen when they select it.

    In my application On select of node we need to update panel and grid is loading based on selected tree view node value. But when user select parent node i don't want to do that.

    Is there any way i can make parent node read only ?

    Thanks,
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Mar 2011 Link to this post

    Hello Neha,

    One possible solution to make a node ReadOnly is to cancel the event when clicking on it.
    ASPX:
    <telerik:RadTreeView runat="server" ID="RadTreeView1" OnClientNodeClicking="ClientNodeClicking">
        <Nodes>
            <telerik:RadTreeNode runat="server" Text="Australia" Value="RootItems">
                <Nodes>
                    <telerik:RadTreeNode runat="server" Text="Sidney">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Brisbane">
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeNode>
           </Nodes>
    </telerik:RadTreeView>

    Java Script:
    <script type="text/javascript">
        function ClientNodeClicking(sender, args) {
           if (args.get_node().get_text() == "Australia") {
               args.set_cancel(true);
            }
       }
    </script>

    -Shinu.
Back to Top