Implement Tree Menu with TreeView
The specific method is: Create a database, design a tree graph information table S_Menu, contain NodeID, ParentID, NodeName, Address, ICON field, and other fields depending on the actual business, the node name NodeName will display on the node of the tree control, NodeID field Save the unique identification number of the node, ParentID indicates the parent node number of the current node, and the identification number consists of a "linked list" to record the structure of the node on the tree. Design a web form placing the TreeView control, modify its properties ID to TVMenu.
The data structure is as follows:
Create Table [DBO]. [S_MENU] (
[NodeID] [char] (6) Collate Chinese_PRC_CI_AS NULL,
[Parentid] [char] (6) collate chinese_prc_ci_as null,
[Nodename] [nvarchar] (50) collate chinese_prc_ci_as null,
[Address] [nvarchar] (50) collate chinese_prc_ci_as null,
[Icon] [nvarchar] (50) collate chinese_prc_ci_as null
) On [primary]
Go
The database is as follows:
NodeId Parentid NodeName Address icon
100000 0 Public Query Department icon_Document.gif
100001 100000 RMB Daily Query Public / A1.ASPX icon_Settings.gif
100002 100000 Foreign Currency Daily Query Public / A2.ASPX icon_Settings.gif
100003 0 Branch Ministry of Science and Technology Icon_Document.gif
100004 100003 RMB Daily Query Tech / A1.ASPX icon_Settings.gif
100005 100003 Foreign Currency Daily Query Tech / A2.ASPX icon_Settings.gif
100006 0 Futian Branch icon_Document.gif
100007 100006 month deposit schedule a1.aspx icon_settings.gif
100008 100006 month Deposit chart A2.ASPX icon_settings.gif
100009 0 Luohu Branch icon_Document.gif
100010 100009 month Deposit Scheme A1.ASPX icon_Settings.gif
100011 100009 month deposit chart A2.ASPX icon_settings.gif
The menu_left.aspx file is as follows:
<% @ Register TagPrefix = "iewc" Namespace = "Microsoft.Web.UI.WebControls" Assembly = "Microsoft.Web.UI.WebControls, Version = 1.0.2.226, Culture = neutral, PublicKeyToken = 31bf3856ad364e35"%>
<% @ Page language = "c #" codebehind = "menu_left.aspx.cs" autoeventwireup = "false" inherits = "hzquery.Menu.Menu_left"%>%>
HEAD>