Repeater判断绑定数据?不知怎么搞?请教
我想在Repeater在绑定的时候判断
<tr style="color: #82B01C;">
<th align="right" width="100px">
回复:
</th>
<th align="left">
</th>
<th align="right">
<%#Eval("ReplyTime") %>
</th>
</tr>
<tr>
<td align="right" class="mailtit">
内容:
</td>
<td colspan="2">
<%#Eval("ReplyContent") %>
</td>
</tr>
这些代码是否在显示?在CS页面中建立一个全局变量 在ItemDataBound中进行绑定 用这个全局变量来判断 做不到?请问有没有更合适的方法,谢谢?
<asp:Repeater ID="repMsgList" runat="server"
onitemdatabound="repMsgList_ItemDataBound">
<ItemTemplate>
<table width="100%" style="line-height: 25px; border: 0;">
<tr style="color: #057dcd;">
<th align="right" width="100px">
<asp:HiddenField ID="hdfvalue" Value='<%#Eval("replytime") %>' runat="server" />
<%#Container.ItemIndex+1 %>. 昵称:
</th>
<th align="left">
<%#Eval("Sender") %>
</th>
<th align="right">
<%#Eval("RecTime") %>
</th>
</tr>
<tr>
<td align="right" style="color: #d33;">
内容:
</td>
<td>
<%#Eval("Content") %>
</td>
</tr>
<% if (statetype)
{
%> <tr style="color: #82B01C;">
<th align="right" width="100px">
回复:
</th>
<th align="left">
</th>
<th align="right">
<%#Eval("ReplyTime") %>
</th>
</tr>
<tr>
<td align="right" class="mailtit">
内容:
</td>
<td colspan="2">
<%#Eval("ReplyContent") %>
</td>
</tr>
<%} %>
</table>
</ItemTemplate>
</asp:Repeater>
[解决办法]
不用itemdatabound
用三目运算符
<%#Eval("replytime") %>.ToStrin()==""?"display:none":""
[解决办法]
<%#Eval("replytime").ToString()==""?"display:none":"" %>