DataGrid Item auto-generate serial number

时间:2021-05-22 16:15:33
when AllowPaging =False
DataGrid Item auto-generate serial number< asp:DataGrid id = " DataGrid1 "  runat = " server " >
DataGrid Item auto-generate serial number    
< Columns >
DataGrid Item auto-generate serial number     
< asp:TemplateColumn >
DataGrid Item auto-generate serial number      
< ItemTemplate >
DataGrid Item auto-generate serial number       
<% # Container.ItemIndex  +   1 %>
DataGrid Item auto-generate serial number      
</ ItemTemplate >
DataGrid Item auto-generate serial number     
</ asp:TemplateColumn >
DataGrid Item auto-generate serial number    
</ Columns >
DataGrid Item auto-generate serial number 
</ asp:DataGrid >
DataGrid Item auto-generate serial number

or

DataGrid Item auto-generate serial number< asp:DataGrid id = " DataGrid1 "  runat = " server " >
DataGrid Item auto-generate serial number    
< Columns >
DataGrid Item auto-generate serial number     
< asp:TemplateColumn >
DataGrid Item auto-generate serial number      
< ItemTemplate >
DataGrid Item auto-generate serial number       
<% this .DataGrid1.Items.Count  +   1 %>
DataGrid Item auto-generate serial number      
</ ItemTemplate >
DataGrid Item auto-generate serial number     
</ asp:TemplateColumn >
DataGrid Item auto-generate serial number    
</ Columns >
DataGrid Item auto-generate serial number 
</ asp:DataGrid >

AllowPaging
="True"

DataGrid Item auto-generate serial number< asp:DataGrid id = " DataGrid1 "  runat = " server "  AllowPaging = " True " >
DataGrid Item auto-generate serial number    
< Columns >
DataGrid Item auto-generate serial number     
< asp:TemplateColumn >
DataGrid Item auto-generate serial number      
< ItemTemplate >
DataGrid Item auto-generate serial number       
<% this .DataGrid1.CurrentPageIndex  *   this .DataGrid1.PageSize  +  Container.ItemIndex  +   1 %>
DataGrid Item auto-generate serial number      
</ ItemTemplate >
DataGrid Item auto-generate serial number     
</ asp:TemplateColumn >
DataGrid Item auto-generate serial number    
</ Columns >
DataGrid Item auto-generate serial number
</ asp:DataGrid >
DataGrid Item auto-generate serial number

Reverse order:
//have been defined:
private int RowsCount = ds.Tables[0].Rows.Count
DataGrid Item auto-generate serial numberasp:DataGrid id = " DataGrid1 "  runat = " server "  AllowPaging = " True " >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                            
< Columns >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                                   
< asp:TemplateColumn >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                                          
< ItemTemplate >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                                                 
<% # RowsCount  -  DataGrid1.CurrentPageIndex  *  DataGrid1.PageSize  -  Container.ItemIndex  %>
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                                          
</ ItemTemplate >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                                   
</ asp:TemplateColumn >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                            
</ Columns >
DataGrid Item auto-generate serial number
DataGrid Item auto-generate serial number                     
</ asp:DataGrid >
DataGrid Item auto-generate serial number