SUGGESTION: Implement Paging on top of search grid as well

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hello,

For the Search Page (search.aspx)

Would be nice to have the paging options on top of products result grid, similar to the one available at the bottom of the result set.
Anyone else felt that need or have implemented it?

Cheers!
Shashank
13 years ago
That's how you can do it:
go to \NopCommerceStore\Modules\Search.ascx and copy

<asp:DataPager ID="pagerProducts" runat="server" PagedControlID="lvProducts" PageSize="2">
                <Fields>
                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True"
                        FirstPageText="<% $NopResources:Search.First %>" LastPageText="<% $NopResources:Search.Last %>"
                        NextPageText="<% $NopResources:Search.Next %>" PreviousPageText="<% $NopResources:Search.Previous %>" />
                </Fields>
            </asp:DataPager>


to another place where you want to see another pager (somewhere before the results)
rename pagerProducts to some other name (for example pagerProducts1)
Go to \NopCommerceStore\Modules\Search.ascx.cs  find every place that uses pagerProducts  and write the same code for your pager (pagerProducts1)
for example find:

this.pagerProducts.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);

add the line

this.pagerProducts1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);

Then rebuild, and it works.
13 years ago
Any suggestions on implementing a dropdown of page groups to view 20,50,100 at a time?
My dropdown worked in templates/categories/productsingrid.aspx

<div class="product-pager">View:
        <asp:DropDownList ID="ddlProductPaging" runat="server" AutoPostBack="True"
            onselectedindexchanged="ddlProductPaging_SelectedIndexChanged">
            <asp:ListItem>20</asp:ListItem>
            <asp:ListItem>50</asp:ListItem>
            <asp:ListItem>100</asp:ListItem>
        </asp:DropDownList>

pageSize= Convert.ToInt16(ddlProductPaging.SelectedValue);

I need help on the "onselectedindexchanged" from above.  My initial try seemed to work but the paging did not display once I clicked back to "20" from "100".  Is that a viewstate issue of some sort?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.