如何禁用主页面上的菜单项和客户端页面上的显示 [英] How can disable Menu item from master page and diplay on client page
问题描述
如何禁用主页面上的菜单项和客户页面上的图层
i有一个带有菜单迭代的母版页
1)首页
2)产品
3)注册
4)登录
我的任务是我必须默认隐藏母版页面上的产品菜单项
当我登录产品菜单将b显示
这里主页iam使用
How can disable Menu item from master page and diplay on client page
i have a master page with menu iteams as
1)Home
2)Products
3)Register
4)Login
My task is i have to hide Products Menu item on master page by default
when i login Products Menu will b Display
Here Master page iam using
推荐答案
如果您正在使用Menu控件,请在主页的PageLoad中使用以下代码: -
If you are using Menu control then, use below code in PageLoad of master page :-
Menu1.Items[index].Enabled = false;
注意: - index是您的菜单项索引,即产品菜单项。
之后当您点击登录按钮时,检查会话,您可以在主页面的页面加载上使用此代码:
Note :- index is your Menu Item index i.e Product menu Item.
After that when your are click to you Login Button, check the session and you can use this code on Page Load of Master page:
if (Convert.ToInt32(Session["login"]) == 1) // What ever you are checking
{
Menu1.Items[index].Enabled = true;
}
注意: - 这里我假设你在会话中保持一定的价值名称并在加载着陆页时进行检查
Note:- Here I assumed you are maintained some value in session with any name and checked it when your landing page is loaded
这篇关于如何禁用主页面上的菜单项和客户端页面上的显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!