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.
Add Lines numbers to products displayed in Catalog Display
- RichWendrock
- 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
Regards,
Richard
http://www.TheHomePageStore.com
AbleCommerce
VERSION: 7.0.7.14588
MSSQL v2005
AC SCHEMA v2005
.NET CLR v2.0.50727.3634
Richard
http://www.TheHomePageStore.com
AbleCommerce
VERSION: 7.0.7.14588
MSSQL v2005
AC SCHEMA v2005
.NET CLR v2.0.50727.3634
Re: Add Lines numbers to products displayed in Catalog Display
Try this code
Locate this code in browse.aspx
and Replace with this code
Now go Browse.aspx.cs file and place this code anywhere inside the class
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>
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;
}
hope this helps!
__________________
s_ismail
AbleCommerce Customization
Free Plugins and Add-Ons
AbleCommerce Plugins and Add-Ons
Plugables Blog
__________________
s_ismail
AbleCommerce Customization
Free Plugins and Add-Ons
AbleCommerce Plugins and Add-Ons
Plugables Blog
- RichWendrock
- 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
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>
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
Richard
http://www.TheHomePageStore.com
AbleCommerce
VERSION: 7.0.7.14588
MSSQL v2005
AC SCHEMA v2005
.NET CLR v2.0.50727.3634