现在的位置: 首页 > 综合 > 正文

给DataGrid添加Number列的简单方法

2013年08月04日 ⁄ 综合 ⁄ 共 364字 ⁄ 字号 评论关闭

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>

抱歉!评论已关闭.