Use of SOLPARTMENU: (2) Generating a menu using the data in the dynamic load database of the SolpartMenu control in the ASP.NET

xiaoxiao2021-03-06  81

Using the SOLPARTMENU control (2) in the ASP.NET page, the data in the dynamic load database generates the data in the menu dynamic load database to generate a menu, mainly designed the database, and the project we do is made this method. Generating a menu, because the problem is related to the privilege, 1, the design database is shown in the figure: where three tables, (xt_menu, xt_jsmx, xt_qxmx) XT_MENU contains all menu items, XT_JSMX contains all user types, XT_QXMX contains The number of menus that each user type can be displayed. 2, data used in a method BindDataTable SolpartMenu the background binding SqlConnection conn = new SqlConnection (this.strcon); SqlDataAdapter cmd = new SqlDataAdapter (); SqlCommand selcmd = new SqlCommand (); cmd.SelectCommand = selcmd; selcmd.CommandText = "[gj_proc_getmenu]"; SELCMD.COMMANDTYPE = commandType.StoredProcedure; Selcmd.connection = conn; Selcmd.Parameters.Add ("@Menu_jsbh", "01"); Dataset DST = New DataSet (); cmd.fill (DST "Menu");

This.SolpartMenu1.bindDataTable (Dst.Tables ["Menu"], "" "," Parent_ID "," Title "," URL "," Image "," Sequence "); there are two ways You can generate a menu for the SOLPARTMENU to add data to the Menudata property to SolpartMenu. The other is to add data using SolpartMenu's AddMenuItem and AddBreak. Such as: Add the first menu item (Simplified Chinese), specifying its ID value 1

Objitem = SOLPARTMENU1.ADDMENUITEM ("1", "Primary School Mathematics", "")

'Add a submenu for "Primary Mathematics", ID value is 11, with icon

SolpartMenu1.AddMenuItem (Objitem, "11", "first grade", "", "introduction.gif")

'Add a menu separation line, determine its location in the submenu of "primary school mathematics" according to parameters 1

SOLPARTMENU1.Addbreak ("1")

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

New Post(0)