用户登录后,有一个页面显示了一个droplist按钮,共有“家长”,“儿子”,“女儿”三个选项。当登录用户为家长时三个选项都可以选择,而儿子登录时只显示“儿子”一个选项,女儿也一样。请问如何操作?

解决方案 »

  1.   

    同学,这里是ASP版块APS.NET 请到这里 http://forum.csdn.net/SList/ASPDotNET/
      

  2.   

    根据不同的角色显示不同的东西
    首先获得当前登录的角色
    数据select * from table where role=?
    当然查出来的东西也不一样
    所显示的也就不一样
      

  3.   

    前台可以直接判断的。像这样
     <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 来操作显示和隐藏
      

  4.   

    你可以直接做两个不同的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";
            }
        }
      

  5.   

    勘误
    页面中相同的部分做为内容页,不同的地方放到master页
    写错了
    应该是
    页面中相同的部分做为master页,不同的地方放到内容页