主营业务:网站制作 网站优化 小程序制作 石家庄网站制作网站建设有限公司欢迎您!
石家庄闪云网络科技有限公司
客服热线15383239821
如何让自己的网站更有质量?

ASPX页面写IF语句怎么写(IF判断)

发布时间:2011/2/19 6:19:00

用 <%内嵌代码%>
比如  :
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>内嵌代码的用法</title>
</head>
<body>
<form id="form1" runat="server">
<%if(DateTime.Now.Hour<12)%>
上午好!
<%else%>
下午好!
</form>
</body>
</html>

 

 

问 :
<table   border="1"   style="width:   545px;   height:   188px">  
                                          <tr>  
                                                  <td>  
                                                          &nbsp;<asp:Label   ID="BODYLabel"   runat="server"   Text= <%#   Eval("BODY")   %> ></asp:Label></td>  
                                          </tr>  
                                </table>  
                       
                如果     RE_BODY不等于空那么显示下面的回复内容,     //   这句话怎么写?  
   
   
   
                                  <table   border="1"   style="width:   543px;   height:   143px">  
                                      <tr>  
                                                  <td>  
                                                          &nbsp;<asp:Label   ID="RE_BODYLabel"   runat="server"   Text= <%#   Eval("RE_BODY")   %> ></asp:Label></td>  
                                          </tr>  
                                  </table>  
 

回答:

ASP.NET推荐是这样写:  
   
   
  <table   border="1"   style="width:   545px;   height:   188px">  
                                          <tr>  
                                                  <td>  
                                                          &nbsp;<asp:Label   ID="BODYLabel"   runat="server"   Text= <%#   Eval("BODY")   %> ></asp:Label></td>  
                                          </tr>  
                                </table>  
   
   
                                  <table   border="1"   style="width:   543px;   height:   143px"   runat="server"   Visibly= <%#   Eval("RE_BODY")   !=   null   %> >  
                                      <tr>  
                                                &n

相关新闻推荐

在线客服 : 服务热线:15383239821 电子邮箱: 27535611@qq.com

公司地址:石家庄市新华区九中街江西大厦4062

备案号:冀ICP备2022000585号-4