Control 'TableBanks' does not implement IPageableItemContainer

自闭症网瘾萝莉.ら 提交于 2019-12-12 01:42:57

问题


I'm gonna use DataPager as follows :

I have a HTML Table :

<table id="TableBanks" runat="server" border="0" align="center" style="width: 93%"
            cellpadding="3" cellspacing="1">
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td> MerchantID </td>
    <td><asp:TextBox ID="TextBoxMerchantID" runat="server" CssClass="textbox" MaxLength="50"></asp:TextBox></td>
  </tr>
  <tr>
    <td> TerminalID </td>
    <td><asp:TextBox ID="TextBoxTerminalID" runat="server" CssClass="textbox" MaxLength="50"></asp:TextBox></td>
  </tr>
  <tr>
    <td> TransactionKey </td>
    <td><asp:TextBox ID="TextBoxTransactionKey" runat="server" CssClass="textbox" MaxLength="50"></asp:TextBox></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><asp:Label ID="LabelResult" runat="server" Style="color: Gray;"></asp:Label></td>
  </tr>
</table>

Now I wanna use it in DataPager, I mean I want dataPager repeat it.
this is my DataPager:

<asp:DataPager ID="DataPager1" runat="server" PagedControlID="TableBanks">
    <Fields>
        <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" ShowNextPageButton="False"
            ShowPreviousPageButton="True" FirstPageText="<<" LastPageText=">>" NextPageText=">"
            PreviousPageText="<" RenderDisabledButtonsAsLabels="false" />
        <asp:NumericPagerField />
        <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" ShowNextPageButton="True"
            ShowPreviousPageButton="False" RenderDisabledButtonsAsLabels="false" NextPageText=">"
            LastPageText=">>" />
    </Fields>
</asp:DataPager>

But the following exception has occurred Control 'TableBanks' does not implement IPageableItemContainer Any helps would be appreciated.
I'm a newbie in asp.net


回答1:


I've found the answer here http://www.codeproject.com/Questions/105933/Using-DataPager-for-Datalist.aspx :

You cannot use DataPager along with DataList as the error says DataList control does not implements IPageableItemContainer.

You can use ListView control instead of DataList.

or

Check Efficient Data Paging with DataList http://weblogs.asp.net/scottgu/archive/2006/01/07/434787.aspx



来源:https://stackoverflow.com/questions/3596615/control-tablebanks-does-not-implement-ipageableitemcontainer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!