它是我的 aspx 页面的 html
<asp:ListView ID="lstviewInvoiceReport" runat="server">
<LayoutTemplate>
<table style="font-size: medium; font-family: Times New Roman">
<tr>
<th>
Date
</th>
<th>
Biller
</th>
<th>
Customer
</th>
<th>
Total
</th>
<th>
Owing
</th>
<th>
Paid
</th>
</tr>
<tr>
</tr>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label runat="server" ID="lblDate"><%#Eval("InvoiceDate") %></asp:Label>
</td>
<td>
<asp:Label runat="server" ID="lblBillerName"><%#Eval("BillerName") %></asp:Label>
</td>
<td>
<asp:Label runat="server" ID="lblCustName"><%#Eval("CustName") %></asp:Label>
</td>
<td>
<asp:Label runat="server" ID="lblTotal"><%#Eval("InvoiceTotal") %></asp:Label>
</td>
<td>
<asp:Label runat="server" ID="lblOwing"><%#Eval("InvoiceOwing") %></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<br />
<asp:DataPager ID="DataPager1" runat="server" PagedControlID="lstviewInvoiceReport"
PageSize="2">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
在后面的代码中:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dt = objBllinvoice.GetInvoiceStatement(6, 3, "20120404", "20120407");
lstviewInvoiceReport.DataSource = dt;
lstviewInvoiceReport.DataBind();
}
}
我正在将 listview 与 datatable 绑定,它工作正常,但是当我对 listview 进行分页时 a) 我需要双击每个按钮以使其工作。b) listview 中的数据没有根据分页更新。
请在这种情况下帮助我。谢谢