使链接不可见或在母版页上可见. [英] Making links invisible or visible on a masterpage..

查看:54
本文介绍了使链接不可见或在母版页上可见.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个方案,其中有一个带有超链接"Edit_Information"的母版页..
我希望此超链接仅对管理员可见,而对一般用户不可见...
所有用户(无论管理员还是普通用户)都使用相同的母版页文件..

I have a scenario where I have a masterpage with a hyperlink "Edit_Information"..
I want that this hyperlink should be visible to the admin only,and not to the general users...
All the users(whether admin or general users) use the same masterpage file..
How can I go about doing dis?

推荐答案

轻松简单地检查用户角色以及管理员是否将超链接的可见性更改为visible.
Easy and simple check the user role and if admin change the visibility of the hyperlink to visible.
<asp:HyperLink runat="server" CssClass="link" ID="hlkEditInfo">Edit_Information </asp:HyperLink>


后面的代码


code behind

if (check admin role)
{
hlkEditInfo.Visible = true;
}
else
{
hlkEditInfo.Visible = false;
}


这篇关于使链接不可见或在母版页上可见.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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