如果员工登录到该站点,他应该能够看到菜单项,除了报告如何隐藏。 [英] if the associate login into this site he should able to see the menu item except reports how to hide.

查看:52
本文介绍了如果员工登录到该站点,他应该能够看到菜单项,除了报告如何隐藏。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在左侧设计了一个母版页,我有菜单项作为注销,时间表,报告,管理用户。如果该员工登录该网站,他应该能够看到菜单项,除了报告如何隐藏。

例如有两种类型的用户:



经理

用户



经理有权查看,编辑和添加新用户

但是用户可以通过访问来查看自己的记录和报告。所以在我的设计中我使用了左侧的菜单,有登出,管理用户,报告,时间表等选项。

如果用户登录到网站,他应该能够看到菜单中的选项像退出,报告。如何隐藏指定登录菜单中的其他项目。

i have designed a master page in the left side i have menu items as logout, time sheets,reports,manage users. if the associate login into this site he should able to see the menu item except reports how to hide.
for example there are two types of users:

manager
user

manager have the access to view, edit and add the new users
but user is havign access to see his own record and reports. so in my design i used menu in the left side there are options like logout,manage users, reports, time sheets.
if user logged in to the site he should be able to see the options in menu like logout,reports. how can we hide other items in menu for the specified login.

推荐答案

我宁愿使用下面的代码动态创建菜单项,而不是隐藏和显示等。在登录时基于用户。

Instead of Hide and Show etc, I would prefer creating the menu item dynamically using code something like below which is based on the User during the time of login.
if (blIsAssociate)
            {
                MenuItem miNewItem = new MenuItem();
                int intMenuItemIndex = 1;
                miNewItem.Text = "Reports";
                miNewItem.Value = "Reports";
                miNewItem.NavigateUrl = "~/somepage.aspx";
                Menu1.Items.AddAt(intMenuItemIndex ,miNewItem);
            }





希望这会有所帮助!



请发布你的代码或逻辑可以获得更好,更准确的答案。



Hope this helps!

Please post your code or logic for better, precise answers.


我做了类似下面的事情。

将此部分添加到具有主菜单控件的MasterPage

确保在开始时只有一个菜单选项卡对所有人都可见。

然后动态添加菜单节点及其相关的页面

I had done something like the below.
Add this part into the MasterPage that has the main menu control
Make sure that in the start there is only one menu tab which is visible to all.
then dynamically add the menu nodes and the page that it relates to
Public Sub menustate(mstate As String)
    If mstate = "Manager" Then
        Dim newme As New MenuItem
        newme.Text = "Admin"
        newme.Value = "Admin"
        newme.NavigateUrl = "~/adminpage.aspx"
        NavigationMenu.Items.AddAt(1, newme)
        NavigationMenu.Items.Item(1).Selectable = True

    Else 
        'NavigationMenu.Items.Item(1).Text = ""
        'NavigationMenu.Items.Item(1).Value = ""
        'NavigationMenu.Items.Item(1).Selectable = False
    End If
End Sub





在身份验证后的子页面中,





In the child page after authentication,

If Session("userrole") = "Admin" Then
    Master.menustate("Manager")
   
Else
    Master.menustate("Agent")

End If


这篇关于如果员工登录到该站点,他应该能够看到菜单项,除了报告如何隐藏。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆