Home > database >  Treeview with binding database, realize the dynamic classification
Treeview with binding database, realize the dynamic classification

Time:09-30

I now in order to realize the treeview dynamic multi-stage effect, don't know what can prawn to help, solve it,

CodePudding user response:

Dynamic multistage yo, what problems themselves more clearly

CodePudding user response:

Recorded in the database will place on the number of levels, according to hierarchy number when generating the TREEVIEW to fetching data is ok

CodePudding user response:

The tree itself is a multi-level,

CodePudding user response:

Write a USEROBJECT according to requirements with respect to OK, some online

CodePudding user response:

In the database will have a record of the serial number of the parent level first and then load the first straton directory then inside the itemchanged retrieval nu way with respect to OK

CodePudding user response:

ding

CodePudding user response:

Multi-level recursive binding tree TreeView (request data in the table have a parent relationship)

The 2009-11-09 09:19



# region to bind the root node and recursive call SetChildren method to realize the child nodes of binding
///
///to bind the root node and recursive call SetChildren method to realize the child nodes of binding
///

///
Public void bindTrees DataSet (ds)
{
DataRow [] DataRow=ds. Tables [0]. Select (" ParentGuid is null ");//select the root node
The foreach (DataRow Dr In DataRow)
{
TreeNode tn=new TreeNode ();
Tn. Text=Dr [r]. "ContentName" ToString ();
Tn. Value=https://bbs.csdn.net/topics/dr [r]. "EntryGuid" ToString ();
TreeView1. Nodes. The Add (tn);//to the root node is bound to the TreeView
Tn. Target="mainFrame";//connect address to main frame page
Tn. NavigateUrl="Detail. Aspx? EntryGuid="+ tn. The Value;
Tn. Expanded=false;
SetChildren (tn, Dr [r]. "EntryGuid" ToString ());//call SelChildren achieve recursive binding child node
}
}
# endregion
# region recursive implementation of child nodes binding
///
///recursive implementation of child nodes binding
///

///
///
Public void SetChildren (TreeNode tn, string guid)
{
DataRow [] DataRow=ds. Tables [0]. Select (" ParentGuid='" + guid + "' ");
The foreach (DataRow Dr In DataRow)
{
TreeNode CTN=new TreeNode ();
CTN. Text=Dr [r]. "ContentName" ToString ();
CTN. Value=https://bbs.csdn.net/topics/dr [r]. "EntryGuid" ToString ();
CTN. Target="mainFrame";
CTN. NavigateUrl="Detail. Aspx? EntryGuid="+ CTN. Value;
Tn..childnodes. Add (CTN);
CTN. Expanded=false;
SetChildren (CTN, Dr [r]. "EntryGuid" ToString ());//recursive
}
}
# endregion

  • Related