Add Lines numbers to products displayed in Catalog Display

Post feature requests to this forum and a pre-configured poll will automatically be created for you.
Post Reply
User avatar
RichWendrock
Commander (CMDR)
Commander (CMDR)
Posts: 134
Joined: Sat Apr 05, 2008 12:55 am
Location: Austin Texas
Contact:

Add Lines numbers to products displayed in Catalog Display

Post by RichWendrock » Fri Dec 10, 2010 5:06 am

Please add line numbers to each product displayed in the Catalog/Browse.aspx page

Many times we need to work with products in the list. Having a line number will make it much easier to find ones place when returning from the EditProduct page.
Regards,
Richard

http://www.TheHomePageStore.com

AbleCommerce
VERSION: 7.0.7.14588
MSSQL v2005
AC SCHEMA v2005
.NET CLR v2.0.50727.3634

User avatar
s_ismail
Commander (CMDR)
Commander (CMDR)
Posts: 162
Joined: Mon Nov 09, 2009 12:20 am
Contact:

Re: Add Lines numbers to products displayed in Catalog Display

Post by s_ismail » Wed Dec 15, 2010 8:33 am

Try this code
Locate this code in browse.aspx

Code: Select all

<asp:GridView ID="CGrid" runat="server" AutoGenerateColumns="False" Width="100%"
                                        DataKeyNames="CatalogNodeId,CatalogNodeType" AllowSorting="False" AllowPaging="True"
                                        PageSize="40" OnRowCommand="CGrid_RowCommand" OnRowDataBound="CGrid_RowDataBound"
                                        SkinID="PagedList" ShowHeader="false" DataSourceID="CatalogDs" EnableViewState="false">
                                        <Columns>
and Replace with this code

Code: Select all

  <asp:GridView ID="CGrid" runat="server" AutoGenerateColumns="False" Width="100%"
                                        DataKeyNames="CatalogNodeId,CatalogNodeType" AllowSorting="False" AllowPaging="True"
                                        PageSize="40" OnRowCommand="CGrid_RowCommand" OnRowDataBound="CGrid_RowDataBound"
                                        SkinID="PagedList" ShowHeader="false" DataSourceID="CatalogDs" EnableViewState="false">
                                        <Columns>
                                            <asp:TemplateField>
                                                <HeaderStyle HorizontalAlign="center" Width="54px" />
                                                <ItemStyle Width="78px" HorizontalAlign="Center" />
                                                <ItemTemplate>
                                                    <asp:Label ID="CounterLbl" runat="server" Text='<%# GetCount(Eval("CatalogNodeType")) %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>

Now go Browse.aspx.cs file and place this code anywhere inside the class

Code: Select all

  int i=0;
    protected string GetCount(object value)
    {   
        CatalogNodeType type = (CatalogNodeType)value;
        if (type == CatalogNodeType.Product)
        {
            i++;
            return string.Format("No # {0}",i.ToString());
        }
        return string.Empty;
    }

User avatar
RichWendrock
Commander (CMDR)
Commander (CMDR)
Posts: 134
Joined: Sat Apr 05, 2008 12:55 am
Location: Austin Texas
Contact:

Re: Add Lines numbers to products displayed in Catalog Display

Post by RichWendrock » Thu Dec 16, 2010 9:59 pm

Thanks very much... I modified your code a little to display only the number followed by a dot and then adjusted the width so everything displays on one line.

Here is the new code.

<asp:GridView ID="CGrid" runat="server" AutoGenerateColumns="False" Width="100%"
DataKeyNames="CatalogNodeId,CatalogNodeType" AllowSorting="False" AllowPaging="True"
PageSize="40" OnRowCommand="CGrid_RowCommand" OnRowDataBound="CGrid_RowDataBound"
SkinID="PagedList" ShowHeader="false" DataSourceID="CatalogDs" EnableViewState="false">
<columns>
<asp:TemplateField HeaderText="Sort">
<headerstyle HorizontalAlign="center" Width="54px" />
<itemstyle Width="100px" HorizontalAlign="Center" />
<itemtemplate>
<asp:Label ID="CounterLbl" runat="server" Text='<%# GetCount(Eval("CatalogNodeType")) %>'></asp:Label>
<asp:LinkButton ID="MU" runat="server" CommandName="Do_Up" ToolTip="Move Up" CommandArgument='<%#string.Format("{0}|{1}", Eval("CatalogNodeTypeId"), Eval("CatalogNodeId"))%>'><img src="<%# GetIconUrl("arrow_up.gif") %>" border="0" alt="Move Up" /></asp:LinkButton>
<asp:LinkButton ID="MD" runat="server" CommandName="Do_Down" ToolTip="Move Down" CommandArgument='<%#string.Format("{0}|{1}", Eval("CatalogNodeTypeId"), Eval("CatalogNodeId"))%>'><img src="<%# GetIconUrl("arrow_down.gif") %>" border="0" alt="Move Down" /></asp:LinkButton>
<img src="<%# GetCatalogIconUrl(Container.DataItem) %>" border="0" alt="<%#Eval("CatalogNodeType")%>" />
</itemtemplate>
Regards,
Richard

http://www.TheHomePageStore.com

AbleCommerce
VERSION: 7.0.7.14588
MSSQL v2005
AC SCHEMA v2005
.NET CLR v2.0.50727.3634

Post Reply