protected void fvWriteUp_DataBound(object sender, EventArgs e) { int totalPages = fvWriteUp.PageCount; int itemCount = fvWriteUp.DataItemCount; // Get the pager row. From MS FormView.BottomPagerRow Property FormViewRow pagerRow = fvWriteUp.BottomPagerRow; // Get the Label controls that display the current page information // from the pager row. Label pageNum = (Label)pagerRow.Cells[0].FindControl("PageNumberLabel"); Label totalNum = (Label)pagerRow.Cells[0].FindControl("TotalPagesLabel"); if ((pageNum != null) && (totalNum != null)) { // Update the Label controls with the current page values. int page = fvWriteUp.PageIndex + 1; int count = fvWriteUp.PageCount; pageNum.Text = page.ToString(); totalNum.Text = count.ToString(); } }
<PagerTemplate> <asp:Table CssClass="fvFooter" ID="RecordNav" runat="server"> <asp:TableRow ID="TableRow4" runat="server"> <asp:TableCell CssClass="recNav"> <asp:Button ID="btnFirst" CssClass="btn btnRecNav" CommandName="Page" CommandArgument="First" Text="First" runat="server" /> <asp:Button ID="btnPrevious" CssClass="btn btnRecNav" CommandName="Page" CommandArgument="Prev" Text="Previous" runat="server" /> <asp:Button ID="btnNext" CssClass="btn btnRecNav" CommandName="Page" CommandArgument="Next" Text="Next" runat="server" /> <asp:Button ID="btnLast" CssClass="btn btnRecNav" CommandName="Page" CommandArgument="Last" Text="Last" runat="server" /> </asp:TableCell><asp:TableCell CssClass="recCounter"> <asp:Label CssClass="lblRecs" ID="lblRecs1" runat="server" Text="Record"></asp:Label> <asp:Label CssClass="lblRecCount" ID="PageNumberLabel" runat="server"></asp:Label> <asp:Label CssClass="lblRecs" ID="lblRecs2" runat="server" Text="of"></asp:Label> <asp:Label CssClass="lblRecCount" ID="TotalPagesLabel" runat="server"></asp:Label> </asp:TableCell><asp:TableCell></asp:TableCell></asp:TableRow></asp:Table> </PagerTemplate> <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NextPreviousFirstLast" NextPageText="Next" PreviousPageText="Previous" Position="Bottom" />
protected void fvWriteUp_PreRender(object sender, EventArgs e) { FormViewRow pagerRow = fvWriteUp.BottomPagerRow; if (pagerRow != null && pagerRow.Visible == false) { pagerRow.Visible = true; fvWriteUp.BottomPagerRow.Visible = true; } }
fvWriteUp.BottomPagerRow;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)