.net 数据绑定gridview 和Repeater 序号,Container.ItemIndex

gridview

<asp:TemplateColumn HeaderText="编号">
   <ItemTemplate>
            <%# Container.DataItemIndex+1%>
   </ItemTemplate>
< /asp:TemplateColumn>

 

Repeater:

</HeaderTemplate>
            <ItemTemplate>

<tr><td><%# Container.ItemIndex+1%></td></tr>

</ItemTemplate>
< /asp:TemplateColumn>

你可能感兴趣的:(GridView)