Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Treeview > Disabling checkbox for an enabled node
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Disabling checkbox for an enabled node

Feed from this thread
  • Glenn Altemose avatar

    Posted on May 17, 2005 (permalink)

    I would like to disable a checkbox associated with an enabled node.

    I have a set of hierarchical data, where the objects represented by the nodes have a required status associated with them - allowed, required, and disallowed.  I am displaying the hierarchical data with checkboxes, and the user can check a checkbox beside any of the nodes whose status is "allowed".  Nodes with a status of required are both checked and disabled, while nodes that are disallowed are not checked and disabled.  I tried to disable the node, but disabling a node prevents me from expanding / collapsing a node - so, in short, how do I disable a checkbox associated with an enabled node?

  • Sebastian Sebastian admin's avatar

    Posted on May 18, 2005 (permalink)

    Hello Glenn,

    Unfortunately this functionality is not supported in the current version of r.a.d.treeview - we apologize if this brings you some trouble. We will forward your request to our developers for further consideration. They will have it in mind along with the input from other customers we have accumulated.  A workaround would be to mark the nodes you wish to be enabled but "disallowed" with Checkable = false. Thus they will be displayed without checkboxes in the browser. We hope this solution fits your case.

    Sincerely yours,
    Stephen, telerik team

  • Glenn Altemose avatar

    Posted on May 20, 2005 (permalink)

    Hello,

    Thank you for the prompt reply!  Unfortunately, the solution really doesn't work for me very well.  I need to be able to display the checkbox for every node - disabled or not.  I think the following three issues should be separated w/r/t nodes in the TreeView:

    1)  Whether or not the checkbox (if present) is enabled
    2)  Whether or not the node is disabled (meaning you can't select it, appears disabled, etc)
    3)  Whether or not the node can be expanded.

    There are times when a "disabled" node who cannot be checked will have a child node that can be checked.

    The way the component works right now is cetainly understandable - but I think the TreeView would be more flexible if you gave developers the ability to configure the three items I mentioned above separately instead of tying them together so tightly.  Just my $0.02 of course..

    Is there any way this will make it into an upcoming Hotfix?  I'm evaulating the entire suite for my organization, and this is the only real sticking issue.  I know it sounds like a minor situation - and I still plan on recommending it - but being able to show this component working as we need it to in a short amount of time is one heck of a selling point..

    Thanks for all the hard work!!

  • Sebastian Sebastian admin's avatar

    Posted on May 23, 2005 (permalink)

    Hello Glenn,

    Thank you for contacting us again.

    We will pass your suggestions to our r.a.d.treeview development department for further consideration. They will have them in mind along with the feedback from other customers we have accumulated. If they appear to be a common request you may see those enhancements implemented in one of the next versions of the product. Unfortunately, due to the urgent tasks our devs have to accomplish for the upcoming hotfix it is not possible to include the improvements you required in it. You will be notified promptly if your suggestions are given a green light.
     
    Kind wishes,
    Stephen, telerik team

  • Posted on Dec 18, 2006 (permalink)

    I just wanted to add my request for this functionality.

    I really need the tree to be 'browesable' in read-only mode, as well as in edit mode.  Parent nodes are also checkable, so if I disable them to make them uncheckable.

    I have a workaround however- I use .Selected to indicate 'on' nodes in ReadOnly mode.  In my PreRender I set all my nodes to Checked/Selected.  If I want the control to be ReadOnly, I set my .BeforeClientClick to a Javascript function which just returns false, which disables the ability to select alternate nodes.  I also set CheckBoxes to false for the entire RadTreeView.  In Editable node, .BeforeClientClick gets set to "" and RadTreeView.CheckBoxes = true.  The nice side effect is that the 'selected' indicates the state of the check boxes before they were changed by the user, so the user can see what the original state was before post back, after which the state is updated to the way they set the checkboxes.

  • Kay avatar

    Posted on Jan 30, 2007 (permalink)

    Did this ever get implemented?  We are trying the same thing.  We have it that you can check mark the child nodes, but when the tree is collapsed we keep the check boxes on the parent nodes too.  So that way the user can tell which Nodes have childe nodes that are checked.  We want to disable the checkbox for the parent nodes though and there is no way to do this at all.

  • Kay avatar

    Posted on Jan 30, 2007 (permalink)

    Did this ever get implemented?  We are trying the same thing.  We have it that you can check mark the child nodes, but when the tree is collapsed we keep the check boxes on the parent nodes too.  So that way the user can tell which Nodes have childe nodes that are checked.  We want to disable the checkbox for the parent nodes though and there is no way to do this at all.

  • Kay avatar

    Posted on Jan 30, 2007 (permalink)

    Or is there a way on the client side when the treeview is loading to use the DOM checkbox object and loop through each node and make sure the checkbox disabled if the node has child nodes?

  • Nick Nick admin's avatar

    Posted on Jan 31, 2007 (permalink)

    Hello Kayden,

    There are currently two ways to disable/hide the checkboxes:
    • Returning false in the BeforeClientCheck event (for certain nodes)
    • Disabling the Checkable property of certain nodes.

    Kind regards,
    Nick
    the telerik team

  • Anh Tu avatar

    Posted on May 28, 2008 (permalink)

    you can using js to disable it, here is a sample code:
    *put the following at the top of page

    <

    script language="javascript" type="text/javascript">

    function DisableCheckBox()

    {

        //rtvTree is the ID of the RadTreeView

        var ctl = document.getElementById('<%=rtvTree.ClientID %>_wrapper');

        var input = ctl.getElementsByTagName('input');

        for(i=0;i<input.length;i++)

        {

            input[i].disabled=

    true;

        }

    }
    </script>

    *and put the following at the end of the page:

    <

    script language="javascript" type="text/javascript">

    DisableCheckBox();

    </script>

  • fuhi avatar

    Posted on Nov 7, 2008 (permalink)

    Hi,

    Can i get any sample code to disable checkbox ( for the Same requirement  - Disable Checkbox for an enabled node) , if there is a workaround or Rad Tree has a built in Property for it.

    Thanks in advance,
    Fuhira

  • Donald McLean avatar

    Posted on Sep 17, 2010 (permalink)

    I have the exact same issue and I was wondering if any progress has been made with this issue.

  • Peter Peter admin's avatar

    Posted on Sep 22, 2010 (permalink)

    Hello fuhi,

    All TreeNodes will display checkboxes if the CheckBoxes property has been enabled. You can, however, disable a checkbox for a particular TreeNode by settings its Checkable property to "False". Please, see CheckBox Support demo for reference.


    Kind regards,
    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  • Dominick avatar

    Posted on Mar 12, 2011 (permalink)

    Setting checkable=false HIDES the checkbox. That's very different than disabling it. I need to disable it. This was requested SIX YEARS ago... You still can't do it????

  • Peter Peter admin's avatar

    Posted on Mar 14, 2011 (permalink)

    Hello Donald,

    This can be easily achieved with jQuery:

    RadTreeView Classic:
    <script type="text/javascript">
           function pageLoad() {
               var $ = $telerik.$;
               var treeview = <%=RadTreeView2.ClientID %>;
               $(".DisabledCheckBox", treeview.RootElement).siblings(':checkbox').attr("disabled", "true");
           }
       </script>
       <telerik:RadTreeView ID="d" runat="server">
       </telerik:RadTreeView>
       <rad:RadTreeView ID="RadTreeView2" runat="server" CheckBoxes="true">
           <Nodes>
               <rad:RadTreeNode runat="server" Text="New Item" CssClass="DisabledCheckBox">
                   <Nodes>
                       <rad:RadTreeNode runat="server" Text="New Item">
                       </rad:RadTreeNode>
                       <rad:RadTreeNode runat="server" Text="New Item" CssClass="DisabledCheckBox">
                       </rad:RadTreeNode>
                       <rad:RadTreeNode runat="server" Text="New Item">
                       </rad:RadTreeNode>
                   </Nodes>
               </rad:RadTreeNode>
               <rad:RadTreeNode runat="server" Text="New Item">
               </rad:RadTreeNode>
               <rad:RadTreeNode runat="server" Text="New Item">
               </rad:RadTreeNode>
           </Nodes>
       </rad:RadTreeView>


    RadTreeView for ASP.NET AJAX:
    <script type="text/javascript">
            function OnClientLoad(sender) {
                var $ = $telerik.$;
                $(".DisabledCheckBox", sender.get_element()).siblings(".rtChk") .attr("disabled", "true");
            }
        </script>
        <telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="true" OnClientLoad="OnClientLoad">
            <Nodes>
                <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1" CssClass="DisabledCheckBox">
                    <Nodes>
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1" CssClass="DisabledCheckBox">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2">
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
                <telerik:RadTreeNode runat="server" Text="Root RadTreeNode2">
                </telerik:RadTreeNode>
                <telerik:RadTreeNode runat="server" Text="Root RadTreeNode3">
                    <Nodes>
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2">
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeView>


    Greetings,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Treeview > Disabling checkbox for an enabled node