locked
Gridview Footable Paging RRS feed

  • Question

  • User-728446177 posted

    I am getting error 'The table  must contain row sections in order of header, body, then footer.' trying to do footable paging in asp.net gridview.  Please see below the code. What have i got wrong?  Thanks in advance. 

      <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.0/footable.standalone.css" rel="stylesheet" />
        <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.0/footable.core.bootstrap.css" rel="stylesheet" />
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.0/footable.js"></script>
         <script type="text/javascript">
             $(function () {
                 $('#<%= GridView1.ClientID%>').footable()
            });
         </script>
     <asp:GridView ID="GridView1" runat="server"  HorizontalAlign="Center" CssClass="footable" OnRowCreated="GridView1_RowCreated"
                            OnRowCommand="GridView1_RowCommand" AutoGenerateColumns="false" data-page-size="3" AllowPaging="true" OnRowDataBound="bound" ShowFooter="true"
                            DataKeyNames="ID" >
                            
                             <Columns>
                                
                             
                                <asp:BoundField DataField="ID" HeaderText="ID" />
                                <asp:BoundField DataField="Server" HeaderText="Server" />
                                 <asp:BoundField DataField="Site" HeaderText="Site" />
                                <asp:BoundField DataField="Area" HeaderText="Area" ItemStyle-Width="100px" ItemStyle-Wrap="true"/>
                                <asp:BoundField DataField="Description" HeaderText="Description"  ItemStyle-Width="700px" ItemStyle-Wrap="true" />
                                <asp:BoundField DataField="Status" HeaderText="Status" />
                                <asp:BoundField DataField="Assigned To" HeaderText="Assigned To" />
                                <asp:BoundField DataField="Test By" HeaderText="Created By" />
                                <asp:BoundField DataField="Test Date" HeaderText="Creation Date" />
                                <asp:BoundField DataField="Priority" HeaderText="Priority" />
                            </Columns>
                        </asp:GridView>
        protected void Page_Load(object sender, EventArgs e)
            {
    
                if (!IsPostBack)
                {
                   
                    BindGrid();
                    
                }
               }
      public void BindGrid()
            {
    
                
                string sp1 = "GetHuHu";
                DataTable HuHu = MySQLHelper.ExecuteDataTable(sp1);
                dt = HuHu;
                //Bind the fetched data to gridview
                if (dt.Rows.Count > 0)
                {
                    GridView1.DataSource = HuHu;
                    GridView1.DataBind();
                    GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
                    GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
                }
    
            }





    Monday, October 10, 2016 7:09 AM

Answers

  • User-1838255255 posted

    Hi maomimomi,

    I tested your code , this issue reproduce . As far as I know , you should set type of the first row to header when it will created . After add it , paging run perfect .

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowIndex == 0)
                {
                    e.Row.RowType = DataControlRowType.Header;
                }
            } 

    Best Regards,

    Eric Du

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 11, 2016 8:18 AM