제품을 채우기 위해 ListView를 사용했습니다. 내 목록보기는 업데이트 패널 안에 있습니다. 이제 데이터 페이저로 두 번째 페이지로 이동하면 두 번째 페이지로 이동하지만 데이터 페이저가 새로 고쳐지지 않습니다. 두 번째 페이지를 클릭하면 너무 첫 페이지 버튼이 강조 표시됩니다.
Aspx
<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<asp:ListView ID="products" runat="server" OnPagePropertiesChanging="OnPagePropertiesChanging">
<ItemTemplate>
Content Here
</ItemTemplate>
<LayoutTemplate>
<div id="itemPlaceholderContainer" runat="server" style="">
<div runat="server" id="itemPlaceholder" />
</div>
<div class="clearfix"></div>
<div class="datapager">
<asp:DataPager ID="DataPager1" ClientIDMode="Static" runat="server" PageSize="24" PagedControlID="products" ViewStateMode="Enabled">
<Fields>
<asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="false" ShowPreviousPageButton="False" ShowNextPageButton="false" ButtonCssClass="nextPre" />
<asp:NumericPagerField ButtonType="Link" ButtonCount="10" />
<asp:NextPreviousPagerField ButtonType="Link" ShowNextPageButton="true" ShowLastPageButton="false" ShowPreviousPageButton="false" ButtonCssClass="nextPre" />
</Fields>
</asp:DataPager>
<div class="clear"></div>
</div>
</LayoutTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>
내부에 실수가있을 수 있습니다 OnPagePropertiesChanging
. 코드가 누락되어 구분하기 어렵지만 다음과 같이 보일 것입니다.
protected void OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
//get the correct page info from the datapager
(products.FindControl("DataPager1") as DataPager).SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
//reload data and rebind the listview
products.DataSource = mySource;
products.DataBind();
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다