如何在datapager中处理next和prev

时间:2015-08-10 06:27:13

标签: c# asp.net linq datapager

我将DB中的所有数据绑定到Entity framwork linq中的datapager转发器。 并且每件事情都运行良好,但系统很慢,所以我试图将每个10个数据分别绑定到数据寻呼机,但我遇到的问题是我无法处理下一个和Datapager中的prev,以便在每个页面绑定10行!

这是aspx页面:

<asp:DataPager ID="pager" 
               runat="server" 
               PagedControlID="repMeetings" 
               PageSiz="10" 
               EnableViewState="true">
    <Fields>
        <asp:NextPreviousPagerField ShowLastPageButton="false" 
                                    ShowNextPageButton="false"
                                    RenderDisabledButtonsAsLabels="true" 
                                    ShowPreviousPageButton="true" 
                                    ButtonType="Link"
                                    ButtonCssClass="prev" 
                                    PreviousPageText='<%$resources:CompaniesViewMessages,PREVIOUS %>' 
                                    ShowFirstPageButton="true"
                                    FirstPageText="<<" />
        <asp:NumericPagerField CurrentPageLabelCssClass="current" 
                               ButtonCount="5" 
                               NumericButtonCssClass="nubmers" />
        <asp:NextPreviousPagerField ShowFirstPageButton="false" 
                                    ShowNextPageButton="true"
                                    ShowPreviousPageButton="false" 
                                    ButtonType="Link" 
                                    ButtonCssClass="next" 
                                    RenderDisabledButtonsAsLabels="true"
                                    ShowLastPageButton="true"
                                    LastPageText=">>" 
                                    NextPageText='<%$resources:CompaniesViewMessages,NEXT %>' />
    </Fields>
</asp:DataPager>

<cc1:DataPagerRepeater ID="repMeetings" 
                       runat="server" PersistentDataSource="true"
                       OnItemDataBound="repMeetings_ItemDataBound" 
                       TotalRows="<%# GetTotalRow() %>" 
                       PagingInDataSource="true">
    <ItemTemplate>
        <tr>
            <td onclick="ViewMyApplication('<%# GetMeetingInfoLink(Eval("Id"))%>')">
                <div>
                    <asp:Label ID="lblMeetingId" 
                               runat="server" 
                               Text='<%# Eval("Id") %>' 
                               CssClass="text_font_offwhite" />
                </div>
            </td>
            <td onclick="ViewMyApplication('<%# GetMeetingInfoLink(Eval("Id"))%>')" 
                class="product_english_name_max_width">
                <div class="text_font_offwhite">
                    <%#Language.GetText(Eval("MeetingDate", "{0:dd/MM/yyyy}"),Eval("MeetingDate", "{0:yyyy/MM/dd}")  ) %>
                </div>
            </td>
            <td onclick="ViewMyApplication('<%# GetMeetingInfoLink(Eval("Id"))%>')">
                <div class="text_font_offwhite">
                    <%# Eval("MeetingDate", "{0:HH:mm}") %>
                </div>
            </td>
            <td>
                <div class="text_font_offwhite">
                    <%# Eval("Location") %>
                </div>
            </td>
            <td onclick="ViewMyApplication('<%# GetMeetingInfoLink(Eval("Id"))%>')">
                <div class="text_font_offwhite">
                    <asp:Label runat="server" 
                               ID="meetingStatusLabel"></asp:Label>
                </div>
            </td>
            <td>
                <input type="checkbox" 
                       id="cbMeetings" 
                       runat="server" 
                       class="repCheckBox"
                       onclick="enable_disableMeetingBtns();" 
                       data-appsids='<%#GetApplicationsIds(Eval("Id")) %>' />
            </td>
        </tr>
    </ItemTemplate>
</cc1:DataPagerRepeater>

我的问题是,如果点击next或prev或任何页码,我怎样才能将总行数计算到datapager并绑定10行?

先谢谢。

0 个答案:

没有答案