Devexpress treelist uses recursion to bind data

Source: Internet
Author: User
Private void treelistbind (datatable DT, int p) {treelist1.nodes. clear (); If (DT. rows. count <1) return; dataview DV = new dataview (DT); DV. rowfilter = "parentfieldname =" + P; If (DV. count <1) return; treelistnode node = treelist1.appendnode ("ID", null); node. setvalue (treelistcolumn1, "first node name"); foreach (datarowview dv1 in DV) {treelistnode Tn = treelist1.appendnode (dv1 ["keyfieldname"], node); tn. setvalue (treelistcolumn1, dv1 ["nodename"]); tn. tag = dv1; getcentralchild (DT, TN, convert. toint16 (dv1 ["keyfieldname"]);} private void getcentralchild (datatable DT, treelistnode TN, int p) {dataview DV = new dataview (DT); DV. rowfilter = "parentfieldname =" + P; If (DV. count <1) return; foreach (datarowview dv1 in DV) {treelistnode TNS = tn. treelist. appendnode (dv1 ["keyfieldname"], TN); // treelistnode Tn = treelist1.appendnode (dv1 ["keyfieldname"], node); TNS. setvalue (treelistcolumn1, dv1 ["nodename"]); TNS. tag = dv1; getcentralchild (DT, TNS, convert. toint16 (dv1 ["keyfieldname"]) ;}}

 

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.