Hi,
I have a strange problem that I don't understand about DataPager. After changing the page set (pages 6 - 10 for example), and clicking on a page (6, 7, 8, 9 or 10), it will displa to the first set of pages counting from 1 again.
Let me explain. I have a ASP.Net page with Listview and DataPager.
<asp:ListView ... DataSourceId="EntityDataSource" DataKeyNames="id">
<LayoutTemplate>
<asp:DataPager runat="server" ID="DataPager1" PageSize="15">
<Fields>
<asp:NextPreviousPagerField FirstPageText="<<" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPageField />
<asp:NextPreviousPagerField LastPageText=">>" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
</asp:ListView>
To update the data, I do a DataBind during PreRender.
protected override void OnPreRender(EventArgs e)
{
lstview1.DataBind();
base.OnPreRender(e);
}
All this works, but the problem is that the set of pages will not remember during postbacks. Let me explain this.
By first request of page, the pages show:
<< 1 2 3 4 5 ... >>
By clicking the ..., the next set of pages will be displayed (and also the data of page 6 will be displayed)
<< ... 6 7 8 9 10 ... >>
But when I click on page 7 to 10, the pages text will display the first set of pages 1-5.
Can someone explain why this happen? Miss I something? Thanks.