<%# Container.DataItemIndex+ 1%> 给DataList或者gridview添加自动增长列
<ItemTemplate>
<table border="0" cellpadding="2" cellspacing="2" style="width: 800px"> <tr> <td colspan="2" rowspan="2"> <table border="0" cellpadding="0" cellspacing="0" style="width: 100%"> <tr> <td width="100"> 第<asp:Label ID="Label9" runat="server" Text="<%# Container.ItemIndex+1%>"></asp:Label>楼</td> <td style="border-bottom: #cccccc 1px dotted"> 作者:<asp:Label ID="Label6" runat="server" Text='<%# Eval("replyName") %>' Width="150px" ></asp:Label>回复于:<asp:Label ID="Label7" runat="server" Text='<%# Eval("replyTime") %>' Width="150px" ></asp:Label></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" style="width: 100%"> <tr> <td width="100"> <asp:Image ID="Image2" runat="server" ImageUrl='<%# Eval("photo") %>' /></td> <td valign="top"> <asp:Label ID="Label8" runat="server" Text='<%# Eval("replyMessage") %>'></asp:Label></td> </tr> </table> </td> </tr> <tr> </tr> </table> </ItemTemplate> |