asp.net2.0 如何根据不同用户同一页面显示的数据做限制? 用户登录后,有一个页面显示了一个droplist按钮,共有“家长”,“儿子”,“女儿”三个选项。当登录用户为家长时三个选项都可以选择,而儿子登录时只显示“儿子”一个选项,女儿也一样。请问如何操作? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 同学,这里是ASP版块APS.NET 请到这里 http://forum.csdn.net/SList/ASPDotNET/ 根据不同的角色显示不同的东西首先获得当前登录的角色数据select * from table where role=?当然查出来的东西也不一样所显示的也就不一样 前台可以直接判断的。像这样 <div style="width: 100%; background-image: url(../images/tablebg2.jpg); height: 22px; vertical-align: middle"> <% if( Decription == "管理员" ) { %> <span onclick="FN_OpenUpload('',500,400)" onmousemove="this.style.backgroundColor='#EEE'" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.cursor='hand'"> <img src="../img/0550376.gif" alt="上传文件" width="14px" height="14px" />上传|</span> <span id="BtnDelete" onmousemove="this.style.backgroundColor='#EEE'" onmouseout="this.style.backgroundColor=''" style="height: 14px" onmouseover="this.style.cursor='hand'"> <img src="../img/05503757.gif" alt="删除" width="14px" height="14px" />删除</span> <% } %> <% else { %> <span onclick="FN_OpenUpload('',500,400)" onmousemove="this.style.backgroundColor='#EEE'" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.cursor='hand'"> <img src="../img/0550376.gif" alt="上传文件" width="14px" height="14px" />上传丨</span> <% } %> </div>这是一个简单的例子 根据角色来判断可以看到那些功能 你可以效仿 或者用display:none 来操作显示和隐藏 你可以直接做两个不同的MasterPage或者利用iframe。一个是家长的,一个是学生的。页面中相同的部分做为内容页,不同的地方放到master页,然后根据不同的用户级别来判断应该调用哪个master页。更换master页可参考如下代码protected void Page_PreInit(object sender, EventArgs e) { if (Session["U_level"].ToString() == "0") { this.MasterPageFile = "~/front/MasterPage_limit.master"; } } 勘误页面中相同的部分做为内容页,不同的地方放到master页写错了应该是页面中相同的部分做为master页,不同的地方放到内容页 js Array数据通过ajax传递到ashx, 怎么反序列化,能变成C#数据吗 我想找师傅,顺便问下merbership身份系统有多少人在用? 求一个母板页布局的例子 .net2005如何添加类库 投票程序的询问 如何做到服务器端主动将当前页面重新发送给客户端? 关于缓存问题 ASP.NET页下实现动态时间显示 如何让gridview在没有数据时显示表头? radiobutton的使用(紧急求助) 关于JS更新ListBox后,CS代码无法获取ListBox值的问题 为什么在FF下,使用<%=str%>为空呢?(坐等答案)-。-
首先获得当前登录的角色
数据select * from table where role=?
当然查出来的东西也不一样
所显示的也就不一样
<div style="width: 100%; background-image: url(../images/tablebg2.jpg); height: 22px;
vertical-align: middle">
<%
if( Decription == "管理员" )
{
%>
<span onclick="FN_OpenUpload('',500,400)" onmousemove="this.style.backgroundColor='#EEE'"
onmouseout="this.style.backgroundColor=''" onmouseover="this.style.cursor='hand'">
<img src="../img/0550376.gif" alt="上传文件" width="14px" height="14px" />上传|</span>
<span id="BtnDelete" onmousemove="this.style.backgroundColor='#EEE'" onmouseout="this.style.backgroundColor=''"
style="height: 14px" onmouseover="this.style.cursor='hand'">
<img src="../img/05503757.gif" alt="删除" width="14px" height="14px" />删除</span>
<%
}
%>
<%
else
{
%>
<span onclick="FN_OpenUpload('',500,400)" onmousemove="this.style.backgroundColor='#EEE'"
onmouseout="this.style.backgroundColor=''" onmouseover="this.style.cursor='hand'">
<img src="../img/0550376.gif" alt="上传文件" width="14px" height="14px" />上传丨</span>
<%
}
%>
</div>这是一个简单的例子 根据角色来判断可以看到那些功能 你可以效仿 或者用display:none 来操作显示和隐藏
更换master页可参考如下代码protected void Page_PreInit(object sender, EventArgs e)
{
if (Session["U_level"].ToString() == "0")
{
this.MasterPageFile = "~/front/MasterPage_limit.master";
}
}
页面中相同的部分做为内容页,不同的地方放到master页
写错了
应该是
页面中相同的部分做为master页,不同的地方放到内容页