Implement Tree Menu with TreeView

xiaoxiao2021-03-05  22

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 database as follows: NodeId ParentId NodeName Address Icon 100000 0 public query portion icon_document.gif 100001 100000 RMB Daily inquiry public / a1.aspx icon_settings.gif 100002 100000 foreign currency daily query public / a2.aspx icon_settings.gif 100003 0 Branch Ministry of 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 schedule a1.aspx icon_settings.gif 100011 100009 month deposit chart A2.ASPX icon_settings.gif menu_left.aspx file as follows: <% @ register tagprefix = "IEWC" Namespace = "Microsoft.Web.ui.WebContr ols "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 "%>

Menu_left

CodeBehind code is as follows: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web .Ui.webcontrols; using system.web.ui.htmlcontrols; usbcontrols; usings; limited;

转载请注明原文地址:https://www.9cbs.com/read-37904.html

New Post(0)