#Region statement // --------------------------------------------- complete treeview //// under Li Miao (Nick.Lee) ASP.NET environment: ------------------------- //// author Control usage program class //////bit: 2005-2-17 // Boyorgril@msn.com// qq: 16503096 //// ------------------- -------------------------------------------------- - # EndRegionusing system; #Region Custom Namespace (Reuse) // Call itself Function Reference Namespace Using NickleE.Web.ui; use system.data; #endregion
A summary description description of Namespace Nicklee.Web.ui {///
#Region Class Public Properties and Private Properties WebDataFill Topfill = New WebDataFill (); WebDataFill Secfill = New WebDataFill (); WebDataFill Thirdfill = New WebDataFill ();
Private string Topmenu; private string secretmenu; #ndregion
#Region Settings Properties Condition Parameters
///
///
///
#ndregion
Public menufill () {// // Todo: Add constructor logic // #Region constructor initial definition
topFill.ConString = System.Configuration.ConfigurationSettings.AppSettings [ "SqlConnectionString"]; secFill.ConString = System.Configuration.ConfigurationSettings.AppSettings [ "SqlConnectionString"]; thirdFill.ConString = System.Configuration.ConfigurationSettings.AppSettings [ "SqlConnectionString"] Topfill.DataTableName = "TopFill"; secfill.dataablename = "secfill"; thirdfill.datatablename = "thirdfill"; #ENDREGON}
#region treeview outline, with datareader / * * * private void treeviewReader () {webDataFill fil1 = new webDataFill (); webDataFill fil2 = new webDataFill (); webDataFill fil3 = new webDataFill (); fil1.ConString = "server = localhost UID = SA; PWD = SA; Database = northwind; "Fil2.constring =" "; pWD = SA; Database = Northwind;"; Fil3.Constring = SERVER = LocalHost; UID = sa ; PWD = SA; Database = northwind; ";
Fil1.sqlQueryString = "select categoryid, categoryname from categories"; fil1.sqlclientDataReader ();
while (fil1.mySqlReader.Read ()) {Microsoft.Web.UI.WebControls.TreeNode topNode = new Microsoft.Web.UI.WebControls.TreeNode ();. topNode.ID = fil1.mySqlReader [ "CategoryID"] ToString ( ); TOPNODE.TEXT = FIL1.MYSQLReader ["categoryName"]. TOSTRING (); TreeView1.nodes.Add (TopNode);
fil2.sqlQueryString = "SELECT ProductID, ProductName FROM Products where categoryID =" Convert.ToInt32 (fil1.mySqlReader [ "CategoryID"]); fil2.sqlClientDataReader (); while (fil2.mySqlReader.Read ()) {Microsoft.Web .UI.WebControls.TreeNode nextNode = new Microsoft.Web.UI.WebControls.TreeNode (); nextNode.Text = fil2.mySqlReader [ "ProductName"] ToString ();. topNode.Nodes.Add (nextNode); fil3.sqlQueryString = "SELECT ProductID, ProductName FROM Products where ProductID <5"; fil3.sqlClientDataReader (); while (fil3.mySqlReader.Read ()) {Microsoft.Web.UI.WebControls.TreeNode thirdNode = new Microsoft.Web.UI.WebControls .TreeNode (); thirdNode.Text = fil3.mySqlReader [ "ProductID"] ToString ();. thirdNode.CheckBox = true;. // thirdNode.NavigateUrl = fil3.mySqlReader [ "ProductID"] ToString (); nextNode.Nodes .Add (thirdnode);} fil3.mysqlreader.close (); Fil3.mysqlConnection.Close ();} fil2.mysqlreader.close (); Fil2.mysqlConnection.Close (); } Fil1.mysqlreader.close (); Fil1.MysqlConnection.Close ();
} * / #Ndregion
}