Instance learning (Classification of upper and lower levels)

Source: Internet
Author: User

Data Table Department

Departid partition name

01 level 1 01

0101 Level 2 0101

0102 Level 2 0102

02 Level 1 02

0201 Level 2 0201

0202 Level 2 0202

  1. /// <Summary>
  2. /// Bind the navigation tree
  3. /// </Summary>
  4. Protected void bindtree ()
  5. {
  6. // Obtain the tree data
  7. Dataset DS = me. executedataset ("select * from Department ");
  8. // Overwrite the parent node
  9. Datarow [] DR1 = Ds. Tables [0]. Select ("Len (departid) = 2 ");
  10. For (INT I = 0; I <dr1.length; I ++)
  11. {
  12. Int count;
  13. Treenode = new treenode ();
  14. Treenode. Text = DR1 [I] ["pipeline name"]. tostring ();
  15. // Treenode. navigateurl = ""; // "../" + DR1 [I] ["remark"]; // navigate here and set fields.
  16. // Treenode. Target = "Main ";
  17. Treenode. selectaction = treenodeselectaction. Expand;
  18. Treenode. imageurl = "../images/book.gif ";
  19. This. TV _nav.nodes.add (treenode );
  20. // Overwrite the subnode
  21. Count = 0;
  22. Datarow [] DR2 = Ds. tables [0]. select ("Len (departid) = 4 and substring (departid, 1, 2) = '" + DR1 [I] ["departid"] + "'");
  23. If (dr1.length> 0)
  24. {
  25. For (Int J = 0; j <dr2.length; j ++)
  26. {
  27. // Add the permission judgment logic here.
  28. // If (qxdm. indexof ("" + DR2 [J] ["lmbh"]) <0)
  29. // Continue;
  30. Treenode childnode = new treenode ();
  31. Childnode. Text = DR2 [J] ["Your name"]. tostring ();
  32. Childnode. navigateurl = "../" + DR2 [J] ["remark"]. tostring ();
  33. Childnode. Target = "Main ";
  34. Childnode. imageurl = "../images/book.gif ";
  35. Treenode. childnodes. Add (childnode );
  36. Count = count + 1;
  37. }
  38. }
  39. // If there are no small classes, delete them together.
  40. If (COUNT = 0)
  41. TV _nav.nodes.remove (treenode );
  42. }
  43. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.