ListView DataPager Button Events / Control Binding Issue?
First Let me say I'm relatively new to the latest version of C# and Visual Studio Ultimate 2013, having only picked it up a couple of months ago.
I have a small web application with several web form pages on it. Two of the web form pages have listviews on them, with DataPagers included in the Layout Templates of each ListView, with each listview also using a SqlDataSource control as its datasource. Within each DataPager's <Fields> group I have the following controls coded:
<asp:Label ID="CurrentPageLabel" runat="server" Text="<%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>" />
<asp:Label ID="TotalPagesLabel" runat="server" Text="<%# Math.Ceiling ((Double)Container.TotalRowCount / Container.PageSize) %>" />
(<asp:Label ID="TotalItemsLabel" runat="server" Text="<%# Container.TotalRowCount %>" />
<asp:NextPreviousPagerField FirstPageImageUrl="~/Images/FirstPageIcon.jpg" FirstPageText="|<" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NextPreviousPagerField PreviousPageImageUrl="~/Images/PreviousPageIcon.jpg" PreviousPageText="<" ShowNextPageButton="False" />
<asp:NextPreviousPagerField NextPageImageUrl="~/Images/NextPageIcon.jpg" NextPageText=">" ShowPreviousPageButton="False" />
<asp:NextPreviousPagerField LastPageImageUrl="~/Images/LastPageIcon.jpg" LastPageText=">|" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
The <TemplatePagerField> contains total pages and rows information, which seems to be correct, while the rest of the fields render as the actual paging controls.
On page load the pages both load correctly and seem to correctly display the first page of data (PageSize="20"). When I click a paging link the first time to go to another page everything appears to work fine and the desired page is displayed.
However it is at this point when I subsequently click another paging link that everything seems to stop working and nothing more happens, when I try to continue with some other kind of paging action.
I think I probably have some kind of problem with improper databinding, or possibly I'm not catching the right event to make this work properly.
I would appreciate any help anyone can offer. Most of the code I have so far has come from various code examples that I've found, but so far getting this to work has been a challenge.
Thanks for reading.