浏览量: 次
用 <%内嵌代码%>
比如 :
<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>
<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>
<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>
<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
[声明]本网转载网络媒体稿件是为了传播更多的信息,此类稿件不代表本网观点,本网不承担此类稿件侵权行为的连带责任。故此,如果您发现本网站的内容侵犯了您的版权,请您的相关内容发至此邮箱【27535611@qq.com】,我们在确认后,会立即删除,保证您的版权。