我用一个repeter控件反复一个table,比如说反复4次
现在需要的是前2个中有个图片,后2个没有即:
table1......image1
table2......image1
table3......
table4......
repeter有没有这个功能
怎样才能实现?
谢谢

解决方案 »

  1.   

    那你可以在itemdataboudn里面来做个判断咯
    if(e.item.itemindex>n)
    {
       图片隐藏
    }
      

  2.   

    设一个全局变量
    然后在
        Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound    End Sub
    事件里头判断
      

  3.   

    <asp:Repeater Runat="server" ID="temp">
    <ItemTemplate>
    <TABLE id="tab1" cellSpacing="0" cellPadding="0" width="244" border="0">
    <TR bgColor="#f7f3f7">
    <TD width="24" bgColor="#f7f3f7" height="22">
    <DIV align="center"><FONT size="2"><IMG height="9" src="images/icon_04.gif" width="9"></FONT></DIV>
    </TD>
    <TD width="220" height="22">
    <DIV align="left"><SPAN class="style2"><A class="px12_gray_04" href="http://babyq.8bao.com/syjq.aspx" target="_blank">使用技巧</A><FONT face="Arial" color="#333333" size="2">

    <IMG height="11" src="images/就是这个图片!!!.gif" width="25"></FONT></SPAN></DIV>
    </TD>
    </TR>
    <TR>
    <TD background="images/Form_8x1_x.gif" colSpan="2" height="1"><FONT face="Arial" color="#333333" size="2"><IMG height="1" src="images/Form_1x1_d.gif" width="1"></FONT></TD>
    </TR>
    </TABLE>
    </ItemTemplate>
    </asp:Repeater>

    if(e.Item.ItemIndex < 2)
    {}里怎么写?请指教
    谢谢~