以后用asp时
用如  if session("empno")="" then
     <table>
              <tr><td>ID</td><td><input id="userid" type="text" name="userid"></td></tr>
     </table>
      else
     <table>
              <tr><td>ID</td><td><%=rs("userid")%></td></tr>
     </table>
象这样的功能,在asp.net中 怎么写的

解决方案 »

  1.   


    if(session["empno"]==null )
    {
       //请登录
    }
    else
    {
       //登录成功
    }
      

  2.   

    前台部分
        <asp:Plan id="NoLogin" runat="server">
         <table> 
                  <tr> <td>ID </td> <td> <asp:TextBox runat="server" id="userid" /> </td> </tr> 
        </table> 
        </asp:Plan>
        <asp:Plan id="IsLogin" runat="server">
        <table> 
                  <tr> <td>ID </td> <td> <asp:Label id="userMsg" runat="server" /> </td> </tr> 
        </table> 
        </asp:Plan>后台部分
    if(String.IsNullOrEmpty(Session("empno")){
    NoLogin.Visible=true;
    IsLogin.Visible=false;
    }else{
    NoLogin.Visible=false;
    IsLogin.Visible=true;
    }要学会前台与后台代码分离才是
      

  3.   

    更正一下,打错了一点
    后台部分if(String.IsNullOrEmpty(Session["empno"]){
      NoLogin.Visible=true;
      IsLogin.Visible=false;
    }else{
      NoLogin.Visible=false;
      IsLogin.Visible=true;
    }