Disable Nodes in codebehind

4 posts, 1 answers
  1. Danny
    Danny avatar
    35 posts
    Member since:
    May 2012

    Posted 29 Mar 2013 Link to this post

    <telerik:RadSiteMap ID="OrderRadSiteMap">
           <Nodes>
              <telerik:RadSiteMapNode Value="WeeklyOrder" ">
                   <Nodes>
                       <telerik:RadSiteMapNode Value="GenerateOrders" />
      
    CodeBehind:
    RadSiteMap OrderSiteMap = (RadSiteMap)OrderMenuItem.FindControl("OrderRadSiteMap");

    I need to disable the GenerateOrders.   The sitemap is nested into RadMenu, and I have no problem finding it- it's the nodes by value method that I haven't found any documentation on.
  2. Answer
    Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 01 Apr 2013 Link to this post

    Hi Danny,

    "WeeklyOrder" is the parent node and "GenerateOrders" is its child. So you could find "GenerateOrders" like search in parent nodes collection using FindChildByValue:

    RadSiteMapNode node = OrderRadSiteMap.Nodes[0].Nodes.FindChildByValue<RadSiteMapNode>("GenerateOrders", true);
    node.Enabled = false;

    Regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Danny
    Danny avatar
    35 posts
    Member since:
    May 2012

    Posted 01 Apr 2013 Link to this post

    Thanks Hristo,
     
    Yeah, I got it to work- and I had already checked that area of documentation you linked.  

    I guess my main area of concern is that the documentation is a bit murky in general, and specifically the <TControlItem> parameter.   What is the significance of it in this method?

    I haven't been able to find much documentation on Telerik.Web.UI.TControlItem in general, actually.
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 02 Apr 2013 Link to this post

    Hi Danny,

    FindChildByValue<TControlItem>(string value) is a Generic Method. It is not designated for RadSiteMap, but for all controls that have child nodes like trees, menus etc. <TControlItem> parameter should be the type of node e.g. RadSiteMapNode for RadSiteMap or RadTreeNode for RadTreeView.

    Regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top