Updated Pager Controls with VIEW ALL option.
Updated Pager Controls with VIEW ALL option.
I am looking for my paging to have an option that says "View All" after the list of page numbers so a customer could click that and it would show all products in the category. Any ideas?
Re: Updated Pager Controls with VIEW ALL option.
Take a look at how the Orders page in Admin works (\Admin\Orders\Default.aspx). It has a Show All option. You can see in the .cs that it checks to the Show All option is set (a value of 0), then it turns off paging for the grid.
I hope that points you in the right direction.
Code: Select all
int pageSize = AlwaysConvert.ToInt(PageSize.SelectedValue);
if (pageSize == 0) OrderGrid.AllowPaging = false;
else
{
OrderGrid.AllowPaging = true;
OrderGrid.PageSize = pageSize;
}
Re: Updated Pager Controls with VIEW ALL option.
Thanks for the tip David. Unfortunately there are few similarities that I can see with the coding regarding paging on a my CategoryGridPage2.ascx.cs and the admin/orders/defaul.aspx.cs I am an excellent copy and paste'er but this doesn't look like its as easy as that.
Re: Updated Pager Controls with VIEW ALL option.
Ah, I misunderstood. Here's a link to another post where someone had the same request but it sounds like they weren't able to get the proposed solution to work.
viewtopic.php?f=44&t=6475&p=67327&hilit=view+all#p67327
So, assuming the above solution doesn't work, I've put together a little hack that seems to work. It is a bit messy, but it seems to work.
First, add this FooterTemplate to the PagerControlsTop and PagerControl (just above the </asp:Repeater> line) in the .ascx page. This add the View All button.
then add this to the private declarations at the top of the .cs code page. This returns the page URL discovered by the paging controls to be used in the View All footer template.
Then change the Page_Init function. This looks to see if the user clicked the View All button and sets the current page index to 0 and sets the page size to 10,000 products (just a big number). Change it from:
to
Finally, look for this code inside the BindPagingControls function. This change saves the baseUrl determined by the paging control.
and change it to:
Again, not pretty, but it seems to work. These changes worked in both the CategoryGridPage.ascx and CategoryGridPage2.aspx controls.
viewtopic.php?f=44&t=6475&p=67327&hilit=view+all#p67327
So, assuming the above solution doesn't work, I've put together a little hack that seems to work. It is a bit messy, but it seems to work.
First, add this FooterTemplate to the PagerControlsTop and PagerControl (just above the </asp:Repeater> line) in the .ascx page. This add the View All button.
Code: Select all
<FooterTemplate>
<a class='<%#Eval("TagClass")%>' href='<%=GetBaseUrl()%>&v=all'>View All</a>
</FooterTemplate>
Code: Select all
private string _BaseUrl = string.Empty;
protected string GetBaseUrl()
{
return _BaseUrl;
}
Code: Select all
string tempSort = Request.QueryString["s"];
Code: Select all
string viewAll = Request.QueryString["v"];
if (viewAll == "all")
{
PagerPanel.Visible = false;
PagerPanelTop.Visible = false;
_PageSize = 10000;
_HiddenPageIndex = 0;
HiddenPageIndex.Value = "0";
}
string tempSort = Request.QueryString["s"];
Code: Select all
if (PagerPanel.Visible)
{
PagerControls.DataSource = NavigationHelper.GetPaginationLinks(currentPagerIndex, totalPages, baseUrl);
PagerControls.DataBind();
}
Code: Select all
_BaseUrl = baseUrl;
if (PagerPanel.Visible)
{
PagerControls.DataSource = NavigationHelper.GetPaginationLinks(currentPagerIndex, totalPages, baseUrl);
PagerControls.DataBind();
}
Re: Updated Pager Controls with VIEW ALL option.
GREAT JOB! Thank you very much David, this is exactly what I needed. THIS IS AWESOME! WORKS PERFECTLY!
Re: Updated Pager Controls with VIEW ALL option.
Awesome, I second that! I was wondering about this. Thanks for providing the infocrazyjoe wrote:GREAT JOB! Thank you very much David, this is exactly what I needed. THIS IS AWESOME! WORKS PERFECTLY!
Re: Updated Pager Controls with VIEW ALL option.
The only problem with having a "view all" is the load on the database.
Re: Updated Pager Controls with VIEW ALL option.
Has anybody added this to their SearchPage? I'd like to give my users the option to View All on the their search results page but the code above does not work. It has a problem with the code since the bindpaging controls are different on searchpage.ascx.cs compared to Catgrid 2 and 4. Let me know if anyone has any ideas on how to get that to work in the SearchPage.ascx.cs
Thanks!
Code: Select all
_BaseUrl = baseUrl;
Thanks!