如何检查转发器控制内的东西?

时间:2013-01-12 19:46:25

标签: asp.net repeater

是否可以使用转发器控件中的If语句检查某些内容并确定要通过哪个HTML语句取决于If语句?像这样(C#代码)

    <asp:Repeater runat="server" >
    <ItemTemplate>
    ...
    if(something) do() .. else do_else()..
    ...
    </ItemTemplate>
    </asp:Repeater>

1 个答案:

答案 0 :(得分:0)

是的如下:

<asp:Repeater runat="server" >
<ItemTemplate>

<%if(something) {%> 
 write this
<%}else{%>
 write that
<%}%>

</ItemTemplate>
</asp:Repeater>

类似:
Format Data in an ASP.NET Repeater
Want 10 rows in every page while binding to a repeater
Can I use filter in asp:repeater?