I have a ListView object in a ASP.Net page with two dataPagers for the same ListView object. One at the top of the page, the other at the bottom. Both have the same properties and both display on the initial loading of the page just fine.
When the user is allowed to search the list for items, the dataPagers usually are intentionally hidden as they don't apply to the short resulting list. However, when I "reset" the filter criteria to show all of the records again, only the dataPager at the bottom of the page is shown. The dataPager at the top of the page remains hidden even though it's properties are set back to visible. It sounds so much like a logic error, but after stepping through the code several times and trying to find an error to no avail, I'm wondering what I might be misunderstanding or not seeing.
Any help would be appreciated.
<asp:DataPager ID="DataPagerHeader" runat="server" PagedControlID="courseListView" PageSize="20" >
<Fields>
<asp:NumericPagerField ButtonType="Button" />
</Fields>
</asp:DataPager>
<asp:ListView ID="courseListView" runat="server" datasourceid="CoursesDataSource" OnSorting="courseListView_Sorting" OnDataBound="courseListView_DataBound" OnItemDataBound="courseListView_ItemDataBound">
<LayoutTemplate>
...
</LayoutTemplate>
<ItemTemplate>
...
</ItemTemplate>
</asp:ListView>
<asp:DataPager ID="DataPagerFooter" runat="server" PagedControlID="courseListView" PageSize="20">
<Fields>
<asp:NumericPagerField ButtonType="Button" />
</Fields>
</asp:DataPager>
Code for Hiding/Showing datapager objects:
protected void courseListView_DataBound(object sender, EventArgs e)
{
DataPagerFooter.Visible = (DataPagerFooter.PageSize < DataPagerFooter.TotalRowCount);
DataPagerHeader.Visible = (DataPagerHeader.PageSize < DataPagerHeader.TotalRowCount);
}
When looking at the source code using Firebug, you see the following where the dataPager should be. Note the lack of tags between the tags.
<span id="ctl00_mainPlaceHolder_DataPagerHeader"></span>