Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
Conditional hide/remove UltraTreeview nodes
posted

Hello everyone,

Has anyone tried the following?

I am using UltraTreeview control in order to retrieve the data from a web.sitemap file.

I have added to the web.sitemap a custom attribute (let's call it CustAtt). Now, when I load the data from the sitemap in the ultratreeview control, I want to display only the nodes that fulfill a certain condition on the CustAtt values. (for instance, CustAtt = "Required".The rest of the nodes (either nodes or leaves) shall be hidden/removed from the treeview.

 I have checked it and double checked it, but i didn't find any solution to this problem.

 Can you help me?

Thank you,

C.

Parents
No Data
Reply
  • 175
    Verified Answer
    posted

     Hello everyone,

    I have solved yesterday's problem. Here is the solution:

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------

            protected void UltraWebTree1_NodeBound(object sender, WebTreeNodeEventArgs e)
            {
                SiteMapNode siteNode = e.Node.DataItem as SiteMapNode;
                if (siteNode["CustAtt"] == "Required")
                    e.Node.Hidden = false;
            }

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------

     

     

     

Children
No Data