到目前为止给DataGrid添加Number列最简单方法
suppose DataGrid named dgCustomize, insert the following code to the first column.
<asp:TemplateColumn HeaderText="No.">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# dgCustomize.CurrentPageIndex*dgCustomize.PageSize+dgCustomize.Items.Count+1 %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# dgCustomize.CurrentPageIndex*dgCustomize.PageSize+dgCustomize.Items.Count+1 %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
posted on 2004-08-23 02:18 birdshome 阅读(1359) 评论(4) 编辑 收藏 举报