GridView 绑定中,如何自动显示序号

作者:vkvi 来源:ITPOW(原创) 日期:2021-8-3

GridView 绑定中,如何自动显示序号:1、2、3、4、5……

<asp:TemplateField HeaderText="序号" ItemStyle-CssClass="show">
	<ItemTemplate>
		<%#(Container.DataItemIndex+1).ToString()%>
	</ItemTemplate>
</asp:TemplateField>

使用:Container.DataItemIndex+1。

相关文章