脚本 <asp:DataGrid id="dgDoubleHeader" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="100%" PageSize="5" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" BackColor="White" CellPadding="4" GridLines="Horizontal"> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#339966"></SelectedItemStyle> <ItemStyle ForeColor="#333333" BackColor="White"></ItemStyle> <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#336666"></HeaderStyle> <FooterStyle ForeColor="#333333" BackColor="White"></FooterStyle> <Columns> <asp:BoundColumn DataField="FirstName" HeaderText="FirstName"></asp:BoundColumn> <asp:BoundColumn DataField="LastName" HeaderText="LastName"></asp:BoundColumn> <asp:BoundColumn DataField="HomePhone" HeaderText="HomePhone"></asp:BoundColumn> <asp:BoundColumn DataField="City" HeaderText="City"></asp:BoundColumn> <asp:BoundColumn DataField="PostalCode" HeaderText="PostalCode"></asp:BoundColumn> </Columns> <PagerStyle HorizontalAlign="Center" ForeColor="White" Position="TopAndBottom" BackColor="#336666" Mode="NumericPages"></PagerStyle> </asp:DataGrid> 代码 protected System.Web.UI.WebControls.DataGrid dgDoubleHeader; //用来判断两个(上下)Pager的位置 private bool upPager = true; private void DataGridDataBind() } private void Page_Load(object sender, System.EventArgs e) } private void dgDoubleHeader_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) } private void dgDoubleHeader_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) } 相关文章: 2021-11-17 2022-02-11 2022-02-11 2022-12-23 2022-01-31 2021-08-08 2021-12-12