给DataGrid添加Number列的简单方法

来源:互联网 发布:nx open api编程技术 编辑:程序博客网 时间:2024/05/16 00:55
 

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>
0 0
原创粉丝点击