Suggestion: Put the product page index at top and bottom
Suggestion: Put the product page index at top and bottom
When browsing for products in the catalog, the page number index section is only at the bottom right. It would a nice interface improvement to have those page number links both at the top and bottom of the page, same side.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Code: Select all
asp:Panel ID="PagerPanel" runat="server"
div class="paging"
asp:Repeater ID="PagerControls" runat="server" OnItemCommand="PagerControls_ItemCommand"
<ItemTemplate>
a class='<Eval>' href='<Eval>'><Eval>
</ItemTemplate>
/asp:Repeater
</div>
/asp:Panel
Hmmm..nevermind, it wont let me paste the code correctly. The code is not correct as I had to modify it in order for it to display here.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
You need to click Disable HTML in this post to get it to display.
On your code, did it work if you gave the control a different ID?
On your code, did it work if you gave the control a different ID?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Code: Select all
<asp:Panel ID="PagerPanel" runat="server">
<div class="paging">
<asp:Repeater ID="PagerControls" runat="server" OnItemCommand="PagerControls_ItemCommand">
<ItemTemplate>
<a class='<%#Eval("TagClass")%>' href='<%#Eval("NavigateUrl")%>'><%#Eval("Text")%></a>
</ItemTemplate>
</asp:Repeater>
</div>
</asp:Panel>
- batmike
- Commander (CMDR)
- Posts: 123
- Joined: Tue Sep 04, 2007 10:46 am
- Location: Minneapolis, MN
- Contact:
In case anyone is still interested in trying this out ... or you've figured it out by now. I went through the ascx file and made two sections and then went through the ascx.cs file and duplicated the code so there's a paging event 1 and paging event 2 but they both work together on all the pages I've tested.
The only thing I would really like to do - and if anyone could help me that would be great - would be to show all the page numbers all the time, instead of replacing the previous pages with the back arrow.
Anyway here is the ascx page code:
Part 1 ... top section:
Part 2 ... bottom section:
And here is the ascx.cs code (Just replace the code from #region PagingControls on down to the bottom of the file, except for the ending curly brace:
The only thing I would really like to do - and if anyone could help me that would be great - would be to show all the page numbers all the time, instead of replacing the previous pages with the back arrow.
Anyway here is the ascx page code:
Part 1 ... top section:
Code: Select all
<asp:Panel ID="PagerPanel1" runat="server">
<div class="paging">
<asp:Repeater ID="PagerControls1" runat="server" OnItemCommand="PagerControls_ItemCommand1">
<ItemTemplate>
<a class='<%#Eval("TagClass")%>' href='<%#Eval("NavigateUrl")%>'><%#Eval("Text")%></a>
</ItemTemplate>
</asp:Repeater>
</div>
</asp:Panel>
Code: Select all
<asp:Panel ID="PagerPanel2" runat="server">
<div class="paging">
<asp:Repeater ID="PagerControls2" runat="server" OnItemCommand="PagerControls_ItemCommand2">
<ItemTemplate>
<a class='<%#Eval("TagClass")%>' href='<%#Eval("NavigateUrl")%>'><%#Eval("Text")%></a>
</ItemTemplate>
</asp:Repeater>
</div>
</asp:Panel>
And here is the ascx.cs code (Just replace the code from #region PagingControls on down to the bottom of the file, except for the ending curly brace:
Code: Select all
#region PagingControls1
protected void BindPagingControls1()
{
if (_LastPageIndex > 0)
{
PagerPanel1.Visible = true;
List<PagerLinkData1> pagerLinkData1 = new List<PagerLinkData1>();
float tempIndex1 = ((float)_HiddenPageIndex / 10) * 10;
int currentPagerIndex1 = (int)tempIndex1 ;
int lastPagerIndex1 = currentPagerIndex1 + _PageSize;
if (lastPagerIndex1 > _LastPageIndex) lastPagerIndex1 = _LastPageIndex;
string baseUrl;
if (_Category != null) baseUrl = this.Page.ResolveClientUrl(_Category.NavigateUrl) + "?";
else baseUrl = NavigationHelper.GetStoreUrl(this.Page, "Search.aspx?");
if (!string.IsNullOrEmpty(_Keywords)) baseUrl += "k=" + Server.UrlEncode(_Keywords) + "&";
if (_ManufacturerId != 0) baseUrl += "m=" + _ManufacturerId.ToString() + "&";
baseUrl += "p=";
string navigateUrl;
if (currentPagerIndex1 > 0)
{
navigateUrl = baseUrl + (currentPagerIndex1 - 1).ToString();
pagerLinkData1.Add(new PagerLinkData1("<", navigateUrl, (currentPagerIndex1 - 1), true));
}
while (currentPagerIndex1 <= lastPagerIndex1)
{
string linkText = ((int)(currentPagerIndex1 + 1)).ToString();
if (currentPagerIndex1 != _HiddenPageIndex)
{
navigateUrl = baseUrl + currentPagerIndex1.ToString();
pagerLinkData1.Add(new PagerLinkData1(linkText, navigateUrl, currentPagerIndex1, (currentPagerIndex1 != _HiddenPageIndex)));
}
else
{
navigateUrl = "#";
pagerLinkData1.Add(new PagerLinkData1(linkText, navigateUrl, currentPagerIndex1, (currentPagerIndex1 != _HiddenPageIndex), "current"));
}
currentPagerIndex1++;
}
if (lastPagerIndex1 < _LastPageIndex)
{
navigateUrl = baseUrl + (lastPagerIndex1 + 1).ToString();
pagerLinkData1.Add(new PagerLinkData1(">", navigateUrl,lastPagerIndex1+1, true));
}
PagerControls1.DataSource = pagerLinkData1;
PagerControls1.DataBind();
}
else
{
PagerPanel1.Visible = false;
}
}
public class PagerLinkData1
{
private string _Text;
private int _PageIndex;
private string _NavigateUrl;
public int PageIndex { get { return _PageIndex; } }
private bool _Enabled;
public string Text { get { return _Text; } }
public string NavigateUrl { get { return _NavigateUrl; } }
public bool Enabled { get { return _Enabled; } }
private string _tagClass;
public string TagClass { get { return _tagClass; } set { _tagClass = value; } }
public PagerLinkData1(string text, string navigateUrl,int pageIndex, bool enabled)
{
_Text = text;
_NavigateUrl = navigateUrl;
_PageIndex = pageIndex;
_Enabled = enabled;
}
public PagerLinkData1(string text, string navigateUrl, int pageIndex, bool enabled,string tagClass)
{
_Text = text;
_NavigateUrl = navigateUrl;
_PageIndex = pageIndex;
_Enabled = enabled;
_tagClass = tagClass;
}
}
protected void PagerControls_ItemCommand1(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Page")
{
InitializePagingVars(false);
_HiddenPageIndex = AlwaysConvert.ToInt((string)e.CommandArgument);
if (_HiddenPageIndex < 0) _HiddenPageIndex = 0;
if (_HiddenPageIndex > _LastPageIndex) _HiddenPageIndex = _LastPageIndex;
HiddenPageIndex.Value = _HiddenPageIndex.ToString();
}
}
protected void SetPagerIndex1()
{
InitializePagingVars(false);
_HiddenPageIndex = AlwaysConvert.ToInt(Request.QueryString["p"]);
if (_HiddenPageIndex < 0) _HiddenPageIndex = 0;
if (_HiddenPageIndex > _LastPageIndex) _HiddenPageIndex = _LastPageIndex;
HiddenPageIndex.Value = _HiddenPageIndex.ToString();
}
#endregion
#region PagingControls
protected void BindPagingControls2()
{
if (_LastPageIndex > 0)
{
PagerPanel2.Visible = true;
List<PagerLinkData2> pagerLinkData2 = new List<PagerLinkData2>();
float tempIndex2 = ((float)_HiddenPageIndex / 10) * 10;
int currentPagerIndex2 = (int)tempIndex2 ;
int lastPagerIndex2 = currentPagerIndex2 + _PageSize;
if (lastPagerIndex2 > _LastPageIndex) lastPagerIndex2 = _LastPageIndex;
string baseUrl;
if (_Category != null) baseUrl = this.Page.ResolveClientUrl(_Category.NavigateUrl) + "?";
else baseUrl = NavigationHelper.GetStoreUrl(this.Page, "Search.aspx?");
if (!string.IsNullOrEmpty(_Keywords)) baseUrl += "k=" + Server.UrlEncode(_Keywords) + "&";
if (_ManufacturerId != 0) baseUrl += "m=" + _ManufacturerId.ToString() + "&";
baseUrl += "p=";
string navigateUrl;
if (currentPagerIndex2 > 0)
{
navigateUrl = baseUrl + (currentPagerIndex2 - 1).ToString();
pagerLinkData2.Add(new PagerLinkData2("<", navigateUrl, (currentPagerIndex2 - 1), true));
}
while (currentPagerIndex2 <= lastPagerIndex2)
{
string linkText = ((int)(currentPagerIndex2 + 1)).ToString();
if (currentPagerIndex2 != _HiddenPageIndex)
{
navigateUrl = baseUrl + currentPagerIndex2.ToString();
pagerLinkData2.Add(new PagerLinkData2(linkText, navigateUrl, currentPagerIndex2, (currentPagerIndex2 != _HiddenPageIndex)));
}
else
{
navigateUrl = "#";
pagerLinkData2.Add(new PagerLinkData2(linkText, navigateUrl, currentPagerIndex2, (currentPagerIndex2 != _HiddenPageIndex), "current"));
}
currentPagerIndex2++;
}
if (lastPagerIndex2 < _LastPageIndex)
{
navigateUrl = baseUrl + (lastPagerIndex2 + 1).ToString();
pagerLinkData2.Add(new PagerLinkData2(">", navigateUrl,lastPagerIndex2+1, true));
}
PagerControls2.DataSource = pagerLinkData2;
PagerControls2.DataBind();
}
else
{
PagerPanel2.Visible = false;
}
}
public class PagerLinkData2
{
private string _Text;
private int _PageIndex;
private string _NavigateUrl;
public int PageIndex { get { return _PageIndex; } }
private bool _Enabled;
public string Text { get { return _Text; } }
public string NavigateUrl { get { return _NavigateUrl; } }
public bool Enabled { get { return _Enabled; } }
private string _tagClass;
public string TagClass { get { return _tagClass; } set { _tagClass = value; } }
public PagerLinkData2(string text, string navigateUrl,int pageIndex, bool enabled)
{
_Text = text;
_NavigateUrl = navigateUrl;
_PageIndex = pageIndex;
_Enabled = enabled;
}
public PagerLinkData2(string text, string navigateUrl, int pageIndex, bool enabled,string tagClass)
{
_Text = text;
_NavigateUrl = navigateUrl;
_PageIndex = pageIndex;
_Enabled = enabled;
_tagClass = tagClass;
}
}
protected void PagerControls_ItemCommand2(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Page")
{
InitializePagingVars(false);
_HiddenPageIndex = AlwaysConvert.ToInt((string)e.CommandArgument);
if (_HiddenPageIndex < 0) _HiddenPageIndex = 0;
if (_HiddenPageIndex > _LastPageIndex) _HiddenPageIndex = _LastPageIndex;
HiddenPageIndex.Value = _HiddenPageIndex.ToString();
}
}
protected void SetPagerIndex2()
{
InitializePagingVars(false);
_HiddenPageIndex = AlwaysConvert.ToInt(Request.QueryString["p"]);
if (_HiddenPageIndex < 0) _HiddenPageIndex = 0;
if (_HiddenPageIndex > _LastPageIndex) _HiddenPageIndex = _LastPageIndex;
HiddenPageIndex.Value = _HiddenPageIndex.ToString();
}
#endregion
protected void Page_PreRender(object sender, EventArgs e)
{
//BIND PAGE
BindPage();
}
- m_plugables
- Commander (CMDR)
- Posts: 149
- Joined: Tue Mar 11, 2008 12:44 am
- Contact: