Dynamic Loading of ultrawebtree

Source: Internet
Author: User

The database table structure is:

Table Name: treetable
Field: l_id: primary key ID
L_name: name of the menu displayed in the tree
P_l_id: A menu
Rochelle page: directed path
Rochelle pagename: File Name

Sample Data:

Rochelle ID

L_name

P_l_id

Rochelle page

Rochelle pagename

1

Root 1

0

.....

 

2

Root 2

0

......

 

3

Sub11

1

...

 

4

Sub12

1

 

 

5

Sub13

1

 

 

6

Sub21

2

 

 

 

// Initialize tree menu
Private   Void Databindtree ()
... {
Dataconn DC = New Dataconn (specialclass. strconn ); // Make a data connection here and change it to your own connection.
Datatable dt = New Datatable ();
// Query the data in the table and construct it as a able
DT = DC. getdatatable ( " Select l_id, l_name, p_l_id, (l_page + l_pagename) as urlpath from treetable " );
Inittree ( This . Ultrawebtree1.nodes, " 0 " , DT );
// Expand Tree
Tvwitems. expandall ();
}

Private   Void Inittree (infragistics. webui. ultrawebnavigator. nodes NDS, String PID, datatable data)
... {
Infragistics. webui. ultrawebnavigator. node tmpnd;
Datarow [] rows = Data. Select ( " P_l_id =' "   + PID +   " ' " );
Foreach (Datarow row In Rows)
... {
Tmpnd =   New Infragistics. webui. ultrawebnavigator. node ();
Tmpnd. datakey = Row [ " Rochelle ID " ]. Tostring (); // ID
Tmpnd. Text = Row [ " L_name " ]. Tostring (); // Node name
Tmpnd. TargetUrl = Row [ " Urlpath " ]. Tostring (); // Path + Page
Tmpnd. targetframe = " Main " ; // Oriented target framework
NDS. Add (tmpnd );
Inittree (tmpnd. nodes, tmpnd. datakey. tostring (), data );
}
}  

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.