how to handle next and prev in datapager

138 views Asked by At

I was bind all data in DB to the datapager repeater from Entity framwork linq . and every thing works fine but the system was slow so i tried to bind each 10 data separately to the data pager but the problem i faced is i can't handle next and prev in Datapager in order to bind 10 rows in each page !!

here's the aspx page :

<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>

my question is how can i give the total rows count to the datapager and bind 10 rows when click next or prev or any Page Number ?

Thanks in Advance .

0

There are 0 answers