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"> </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"> </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"
开发者_如何学C 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.netI'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
精彩评论