DataPager的不是列表视图正常工作
它我的aspx页面的HTMLDataPager的不是列表视图正常工作
<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 a)我需要单击每个按钮使其工作。 b)listview内部的数据不会根据分页更新。
请在这种情况下帮助我。谢谢
回答:
当您使用数据引擎时,您必须在PreRender中绑定数据。您目前的Page_Load
数据绑定回答:
尝试把你绑定数据PagePropertiesChanged事件是这样的:
protected void lstviewInvoiceReport_PagePropertiesChanged(object sender, EventArgs e)      { 
      BindData(); 
     } 
以上是 DataPager的不是列表视图正常工作 的全部内容, 来源链接: utcz.com/qa/257861.html



