DT 的数据字典
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

71 lines
3.0 KiB

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Dal;
public partial class UC_LeftUc : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Page is PageEx)
{
string topMenuId = Convert.ToString((Page as PageEx).TopMenuId);
if (topMenuId != "0") //不是顶级菜单
{
StringBuilder sbLeftMenus = new StringBuilder();
string strFirsh = "<div class='Title'><div class='HeaderCoop'></div>{0}</div>";
string strSecond = "<div id='foldheader{0}' class='Header'><div class='HeaderExpand'></div>{1}</div>";
string strThree = "<li><a href='{0}' id='submenu'>{1}</a></li>";
DataSet dsAllMenus = MenusDal.Select(); //(Page as PageEx).RoleId
if (SqlHelper.HasRow(dsAllMenus))
{
//一级菜单
DataRow[] dsFirsts = dsAllMenus.Tables[0].Select("menuid=" + topMenuId);
if (dsFirsts != null && dsFirsts.Length == 1)
{
//一级
Model.Menus menusFirst = new Model.Menus(dsFirsts[0]);
sbLeftMenus.Append(string.Format(strFirsh, menusFirst.Text));
#region 二级
int iSecond = 0;
DataRow[] drSeconds = dsAllMenus.Tables[0].Select("upmenuid=" + topMenuId);
foreach (DataRow drSecond in drSeconds)
{
Model.Menus menusSecond = new Model.Menus(drSecond);
sbLeftMenus.Append(string.Format(strSecond,iSecond++, menusSecond.Text));
#region 三级
sbLeftMenus.Append("<ul class='List'>");
DataRow[] drThrees = dsAllMenus.Tables[0].Select("upmenuid=" + menusSecond.MenuId.ToString());
foreach (DataRow drThree in drThrees)
{
Model.Menus menusThree = new Model.Menus(drThree);
sbLeftMenus.Append(string.Format(strThree, menusThree.Url, menusThree.Text));
}
sbLeftMenus.Append("</ul>");
#endregion
}
#endregion
}
}
ltLeftMenu.Text = sbLeftMenus.ToString();
}
}
}
}
}