Click here to Skip to main content
12,402,189 members (29,793 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# CSS Treeview
Hi,

I have scenario which binds the Brand, category and sub categories in a treeview dynamically. I have separate styles for RootNode - Brand, ParentNode - Category and ChildNode- SubCategory. Parent Node and Root node should not be clicked only child nodes can be clicked. All this works fine but I have also a scenario that a Category may not have sub category but it should have parent node style and it can be clicked also. I am not able to do this.

Ex: Brand1
       Category1
           subCategory1.1
           subCategory1.2
       Category2
           subCategory2.1
           subCategory2.2
       Category3
       Category4
       Category5

In the above example Brand1,Category1 and Category2 should not be clickable whereas only subcategories can be clicked and Category that does not have any subcategory can also be clicked. Brand1 - should have one style and all the main categories should have one style and all the sub categories should have one style.
Posted 5-Jul-12 3:14am
Comments
John Orendt 5-Jul-12 23:01pm
   
You mean only nodes with no children are clickable?
Beula Joyce 6-Jul-12 0:18am
   
yes
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You have to use
.find()
function of jQuery.
Check this jQuery API link[^] for demos.
Just try to add your logic and use this function.
And let me know whether you complete it or not.
Please post your test codes and logic using
.find()
, so that I can help you. Smile | :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,
I have solved it by myself. I have created the treeview controls at runtime and that solved my problem.

Thank you all for your support
  Permalink  
Comments
Tadit Dash 6-Jul-12 6:19am
   
That's sounds nice. As you are doing it in client side before, so I posted one solution.... Anyway great job... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 6 Jul 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100