-1
編程菜單項我想禁用或啓用我從數據庫用戶菜單欄,我已經做了父母的菜單項,但我也想禁用或啓用的子菜單項,這裏是我的代碼禁用或啓用從數據庫
StrSql = "Select serial_no,optionName,MenuID from [User_" + Session["UserEmail"] + "]";
StrSql = StrSql + " Order By serial_no";
DataSet rs = (DataSet)MethodClass.ConnectionToQuery(StrSql);
if (rs.Tables[0].Rows.Count > 0)
{
for (i = 0; i < MnuUserManagement.Items.Count; i++)
{
StrOpt = MnuUserManagement.Items[i].Text.ToString();
if (StrOpt != "-" || StrOpt == "")
{
for (j = 0; j < rs.Tables[0].Rows.Count ; j++)
{
if (StrOpt == rs.Tables[0].Rows[j]["optionName"].ToString())
{
MnuUserManagement.Items[i].Enabled = true;
}
}
}
}
}
請出示創建菜單您的數據庫表結構?還有一些標記。請參閱本:HTTP://www.codingfusion.com/Post/Multilevel-Dynamic-CSS3-Dropdown-Menu-in-asp-net – 2014-12-19 10:35:18