1.ASP.NET1.1的DataGrid加入一模板列,然后模板列中写如下代码:
<asp:TemplateColumn>
<ItemTemplate>
<%# this.DataGrid1.CurrentPageIndex * this.DataGrid1.PageSize + Container.ItemIndex + 1%>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
2.ASP.NET2.0的GridView加入一模板列,然后……:
<%# this.GridView1.CurrentPageIndex * this.GridView1.PageSize + Container.RowIndex + 1%>