问题描述
- vs2008 menu控件子菜单显示不出来
-
前台代码:
Font-Names="宋体" Font-Size="9pt" ForeColor="White" Orientation="Horizontal"
StaticSubMenuIndent="10px" OnMenuItemClick="menuNav_MenuItemClick"
DynamicPopOutImageTextFormatString="" Height="22px" Width="658px">/asp:MenuItem
/asp:MenuItem
/asp:MenuItem
/asp:MenuItem
/asp:MenuItem/asp:MenuItem
/asp:MenuItem
/asp:MenuItem/asp:MenuItem
/asp:MenuItem
/asp:MenuItem/asp:MenuItem
/asp:MenuItem
/asp:MenuItem/asp:MenuItem
/asp:MenuItem
/asp:MenuItem/asp:MenuItem
/asp:MenuItem
/asp:MenuItem
/asp:MenuItem
/asp:MenuItem/asp:Menu
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["role"] == "Reader")
{
menuNav.Items[1].Enabled = false;
menuNav.Items[2].Enabled = false;
menuNav.Items[3].Enabled = false;
menuNav.Items[5].Enabled = false;
}
else
{
if (Session["Name"] != null)
{
labAdmin.Text = Session["Name"].ToString();
adminmanage.Name = Session["Name"].ToString();
}
DataSet adminds = adminmanage.GetAllAdminByName(adminmanage, "tb_admin");
string strAdminID = adminds.Tables[0].Rows[0][0].ToString();
purviewmanage.ID = strAdminID;
DataSet pviewds = purviewmanage.FindPurviewByID(purviewmanage, "tb_purview");
bool sysset = Convert.ToBoolean(pviewds.Tables[0].Rows[0][1].ToString());
bool readset = Convert.ToBoolean(pviewds.Tables[0].Rows[0][2].ToString());
bool bookset = Convert.ToBoolean(pviewds.Tables[0].Rows[0][3].ToString());
bool borrowback = Convert.ToBoolean(pviewds.Tables[0].Rows[0][4].ToString());
bool sysquery = Convert.ToBoolean(pviewds.Tables[0].Rows[0][5].ToString());if (sysset == true) { menuNav.Items[1].Enabled = true; } else { menuNav.Items[1].Enabled = false; } if (readset == true) { menuNav.Items[2].Enabled = true; } else { menuNav.Items[2].Enabled = false; } if (bookset == true) { menuNav.Items[3].Enabled = true; } else { menuNav.Items[3].Enabled = false; } if (borrowback == true) { menuNav.Items[4].Enabled = true; } else { menuNav.Items[4].Enabled = false; } if (sysquery == true) { menuNav.Items[5].Enabled = true; } else { menuNav.Items[5].Enabled = false; } } } protected void menuNav_MenuItemClick(object sender, MenuEventArgs e) { if (menuNav.SelectedValue == "退出系统") { Response.Write("<script>window.close();</script>"); } }