• DataGrid Item autogenerate serial number


    when AllowPaging=False
    <asp:DataGrid id="DataGrid1" runat="server">
        
    <Columns>
         
    <asp:TemplateColumn>
          
    <ItemTemplate>
           
    <%# Container.ItemIndex + 1%>
          
    </ItemTemplate>
         
    </asp:TemplateColumn>
        
    </Columns>
     
    </asp:DataGrid>

    or

    <asp:DataGrid id="DataGrid1" runat="server">
        
    <Columns>
         
    <asp:TemplateColumn>
          
    <ItemTemplate>
           
    <%this.DataGrid1.Items.Count + 1%>
          
    </ItemTemplate>
         
    </asp:TemplateColumn>
        
    </Columns>
     
    </asp:DataGrid>

    AllowPaging
    ="True"

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

    Reverse order:
    //have been defined:
    private int RowsCount = ds.Tables[0].Rows.Count
    asp:DataGrid id="DataGrid1" runat="server" AllowPaging="True">

                                
    <Columns>

                                       
    <asp:TemplateColumn>

                                              
    <ItemTemplate>

                                                     
    <%# RowsCount - DataGrid1.CurrentPageIndex * DataGrid1.PageSize - Container.ItemIndex %>

                                              
    </ItemTemplate>

                                       
    </asp:TemplateColumn>

                                
    </Columns>

                         
    </asp:DataGrid>
  • 相关阅读:
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    2.5.3 表单过滤器
    2.5.2 子过滤器
    2.5.1 位置过滤器:
    2.4 通过属性来选择元素
    2.3 根据层级查找元素
    2.2.4 元素选择器
    2.2.3 Class选择器
    2.2.2 ID选择器
  • 原文地址:https://www.cnblogs.com/archmaster/p/87168.html
Copyright © 2020-2023  润新知