Html 如何显示中继器内部的交替部分

Html 如何显示中继器内部的交替部分,html,css,asp.net,repeater,Html,Css,Asp.net,Repeater,中继器: <asp:Repeater ID="repeater" runat="server"> <ItemTemplate> <%# Container.ItemIndex % 2 == 0 %> <div class="class1"> <span style="float: left;"> <img src="" />

中继器:

<asp:Repeater ID="repeater" runat="server">
    <ItemTemplate>
        <%# Container.ItemIndex % 2 == 0 %>
        <div class="class1">
            <span style="float: left;">
                <img src="" />
            </span>
            <span style="float: right;">
                <asp:Label id="lFN" runat="server" />
            </span>
        </div>
        <%# Container.ItemIndex % 2 != 0 %>
        <div class="class2">
            <span style="float: right;">
                <img src="" />
            </span>
            <span style="float: left;">
                <asp:Label id="lFN2" runat="server" />
            </span>
        </div>
    </ItemTemplate>
</asp:Repeater>
我怎样才能实现上述目标

我现在的方法是只显示
TRUE-FALSE
,并多次显示记录。


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

        <div class='<%# Container.ItemIndex % 2 == 0 ? "class1" : "class2" %>'>
            <span style='<%# Container.ItemIndex % 2 == 0 ? "float:left;" : "float:right;" %>'>
                <img src='<%# Eval("ProfilePic") %>' />
            </span>
            <span style='<%# Container.ItemIndex % 2 == 0 ? "float:right;" : "float:left;" %>'>
                <asp:Label id="lFN" runat="server" Text='<%# Eval("Name") %>' />
            </span>
        </div>

    </ItemTemplate>
</asp:Repeater>
' />
谢谢。我以为这就是方法。
<asp:Repeater ID="repeater" runat="server">
    <ItemTemplate>

        <div class='<%# Container.ItemIndex % 2 == 0 ? "class1" : "class2" %>'>
            <span style='<%# Container.ItemIndex % 2 == 0 ? "float:left;" : "float:right;" %>'>
                <img src='<%# Eval("ProfilePic") %>' />
            </span>
            <span style='<%# Container.ItemIndex % 2 == 0 ? "float:right;" : "float:left;" %>'>
                <asp:Label id="lFN" runat="server" Text='<%# Eval("Name") %>' />
            </span>
        </div>

    </ItemTemplate>
</asp:Repeater>