Click here to Skip to main content
Rate this: bad
good
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 at 5-Jul-12 23:01pm
   
You mean only nodes with no children are clickable?
Beula Joyce at 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 at 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
0 Sergey Alexandrovich Kryukov 458
1 OriginalGriff 384
2 George Jonsson 233
3 Animesh Datta 130
4 Shemeemsha RA 128
0 OriginalGriff 6,179
1 Sergey Alexandrovich Kryukov 5,616
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 6 Jul 2012
Copyright © CodeProject, 1999-2014
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