2013-02-19 66 views
0

我有这样的ListView与DataPager的ListView控件DataPager的工作不

<asp:ListView ID="ProfilesList" runat="server" OnItemDataBound="ProfilesList_DataBound" > 
       <LayoutTemplate> 
        <asp:DataPager runat="server" ID="ContactsDataPager" PageSize="12"> 
      <Fields> 
       <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true" 
       FirstPageText="|&lt;&lt; " LastPageText=" &gt;&gt;|" 
       NextPageText=" &gt; " PreviousPageText=" &lt; " /> 
      </Fields> 
      </asp:DataPager> 
       <table cellpadding="0" cellspacing="0" class="GridBody" style="padding:0; width:910px; border-bottom-style:none;"> 
        <tr class="GridHeader" style="text-align:center;"> 
         <td style="width:8px; padding-left:5px; border-bottom-style:none; "> 
         </td> 
         <td style="width:274px; border-bottom-style:none;"> 
          Person Info 
         </td> 
         <td style="width:273px; border-bottom-style:none;"> 
          Company Info 
         </td> 
         <td style="width:272px; border-bottom-style:none;"> 
          User Attributes 
         </td> 
        </tr> 
       </table> 
        <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder> 
       </div> 
      </LayoutTemplate> 

请记住,这仅仅是ListView中的第一位为整件事是巨大的。

无论如何,按钮出现,但他们什么也没做......我必须在我的代码后面做些什么吗?从ListView控件

+0

把你的DataPager的ListView的外面,然后设置DataPager的财产PagedControlID到ProfilesList – 2013-02-19 18:40:04

回答

1

提取DataPager的,设置PagedControlID财产和实现PagePropertiesChanging方法:

//set current page startindex, max rows and rebind to false 
ContactsDataPager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); 
//rebind List View 
BindListView(); 

采取在看看这篇文章: http://dotnet.dzone.com/articles/paging-listview-using