Custom paging in GridView

D

Dr.Gigabit

Hello all,

I try to implement custom paging for GridView and have the following
problem. I use TextBox field to display the current page.

<PagerTemplate>
.....
<asp:TextBox ID="CurrentPageNumber" Width="15px" runat="server" />
of <%= GridView1.PageCount %>
.....
</PagerTemplate>

And I use the following code to change the page's number

protected void GridView1_PageIndexChanging(object sender,
GridViewPageEventArgs e)
{
// Retrieve the pager row.
GridViewRow pagerRow = GridView1.BottomPagerRow;

TextBox txtCurrentPage =
(TextBox)pagerRow.FindControl("CurrentPageNumber");
txtCurrentPage.Text = e.NewPageIndex.ToString();
}


But the number is only displayed on the last page?
Could anybody explain this behaviour?

Tnanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top