Asp.net ListView数据寻呼机不工作
我有一个带有数据寻呼机的列表视图Asp.net ListView数据寻呼机不工作,asp.net,listview,datapager,Asp.net,Listview,Datapager,我有一个带有数据寻呼机的列表视图 <asp:ListView ID="ProfilesList" runat="server" OnItemDataBound="ProfilesList_DataBound" > <LayoutTemplate> <asp:DataPager runat="server" ID="ContactsDataPager" PageSize="12">
<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="|<< " LastPageText=" >>|"
NextPageText=" > " PreviousPageText=" < " />
</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提取DataPager,设置PagedControlID属性并实现PagePropertiesChange方法:
//set current page startindex, max rows and rebind to false
ContactsDataPager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
//rebind List View
BindListView();
请看这篇文章:
将DataPager置于ListView之外,然后将DataPager的属性PagedControlID设置为ProfilesList