DreamTeK
DreamTeK

Reputation: 34287

Rendering the gridview pager into the tfoot section of the table

Is it possible to get the asp.net pager control for a gridview into the tfoot section?

//Render thead tfoot sections
Private Sub Page_PreRenderComplete(sender As Object, e As EventArgs) Handles Me.PreRenderComplete
  If gv.Rows.Count > 0 Then
    gv.HeaderRow.TableSection = TableRowSection.TableHeader
    gv.FooterRow.TableSection = TableRowSection.TableFooter
  End If
End Sub

//Initiate pager
Protected Sub gv_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles gv.PageIndexChanging
  gv.PageIndex = e.NewPageIndex
  Bind_gv()
End Sub

Pager automatically gets generated in the table body as a tr at the bottom by default or at the top if specified.

DESIRED OUTPUT

<table id="gv">
  <thead></thead>
  <tbody>
    //Table data ...
  </tbody>
  <tfoot>
    //Pager here
  </tfoot>
</table

Upvotes: 3

Views: 599

Answers (1)

Joe Salazar
Joe Salazar

Reputation: 400

Yes you can do it. You have to add the following code:

gv.BottomPagerRow.TableSection = TableRowSection.TableFooter

Upvotes: 3

Related Questions