2017-06-30 19 views
-1

ListViewトポパレート製品を使用しました。私のlistviewは更新パネルの中にあります。今私はdatapagerで2番目のページに行くと、それは2番目のページに行くが、datapagerはさわやかではありません。 2ページ目をクリックすると、最初のページボタンも強調表示されます。Asp.net Datapager updatepanelの使用中にリフレッシュしない

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> 

答えて

0

おそらく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(); 
} 
+0

この問題は解決されました。しかし実際には、私はここでこの問題に直面しています。https://stackoverflow.com/questions/44884562/applying-filter-in-listview-not-working-with-datapager – SUN

関連する問題