Code:
// ------------------------------------------------------------------------------------------
// Copyright AspDotNetStorefront.com, 1995-2007. All Rights Reserved.
// http://www.aspdotnetstorefront.com
// For details on this license please visit the product homepage at the URL above.
// THE ABOVE NOTICE MUST REMAIN INTACT.
// ------------------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.IO;
using System.Resources;
using System.Globalization;
using System.Reflection;
using System.Data;
using System.Configuration;
using System.Drawing;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
using AspDotNetStorefrontCommon;
namespace Mycustom
{
public class AjaxPagingControl
{
public string AjaxPagingControl(string sBaseURL, String sPageNum, String sNumPages)
{
//-=-=-=- daRez: Pagination Mods
//-=-=-=- Custom Ajax Pagination from http://www.dynamicdrive.com/dynamicindex17/ajaxpaginate/ (rezDefied)
//-=-=-=- DEPENDENCIES: daPagination.js, daPagination.css
InputValidator IV = new InputValidator("PagingControl");
String BaseURL = IV.ValidateString("BaseURL", sBaseURL);
int PageNum = IV.ValidateInt("PageNum", sPageNum);
int NumPages = IV.ValidateInt("NumPage", sNumPages);
string result = String.Empty;
if (NumPages < 2)
{
return "";
}
if (BaseURL.Length == 0)
{
BaseURL = CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING");
}
if (PageNum == 0)
{
PageNum = CommonLogic.QueryStringUSInt("PageNum");
}
if (PageNum == 0)
{
PageNum = 1;
}
String Separator = "?";
if (BaseURL.IndexOf("?") != -1)
{
Separator = "&";
}
StringBuilder tmpS = new StringBuilder(4096);
tmpS.Append("<script type=\"text/javascript\">");
tmpS.Append("var daPaginationArray = new Array(" + sNumPages + ");");
for (int i = 0; i < NumPages; i++)
{
if (BaseURL.ToLowerInvariant().IndexOf("pagenum=") == -1)
{
tmpS.Append("daPaginationArray[" + i.ToString() + "] = \"" + BaseURL + Separator + "pagenum=" + (i + 1).ToString() + "\";");
}
else
{
tmpS.Append("daPaginationArray[" + i.ToString() + "] = \"" + Regex.Replace(BaseURL, @"pagenum=\d+", "pagenum=" + (i + 1).ToString(), RegexOptions.Compiled) + "\";");
}
}
tmpS.Append("var daPages = {pages: daPaginationArray, selectedpage: 0};");
tmpS.Append("var daBook = new ajaxpageclass.createBook(daPages, \"pcontent\", [\"paginate-top\",\"paginate-bottom\"]);");
tmpS.Append("</script>");
result = tmpS.ToString();
return result;
}
}
}
My Entity.tableexpanded2.xml.config
Code:
<?xml version="1.0" standalone="yes" ?>
<package version="2.1" displayname="Entity Table Expanded 2" debug="false" includeentityhelper="true">
<!-- ###################################################################################################### -->
<!-- Copyright AspDotNetStorefront.com, 1995-2009. All Rights Reserved. -->
<!-- http://www.aspdotnetstorefront.com -->
<!-- For details on this license please visit the product homepage at the URL above. -->
<!-- THE ABOVE NOTICE MUST REMAIN INTACT. -->
<!-- -->
<!-- ###################################################################################################### -->
<query name="Products" rowElementName="Product">
<sql>
<![CDATA[
exec dbo.aspdnsf_GetProducts
@categoryID = @CatID,
@sectionID = @SecID,
@manufacturerID = @ManID,
@distributorID = @DistID,
@genreID = @GenreID,
@vectorID = @VectorID,
@localeName = @locale,
@CustomerLevelID = @CustLevelID,
@affiliateID = @AffID,
@ProductTypeID = @ProdTypeID,
@ViewType = 1,
@pagenum = @pgnum,
@pagesize = null,
@StatsFirst = 0,
@publishedonly = 1,
@ExcludePacks = 0,
@ExcludeKits = 0,
@ExcludeSysProds = 0,
@InventoryFilter = @InvFilter,
@sortEntityName = @entityname
]]>
</sql>
<queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@SecID" paramtype="runtime" requestparamname="SecID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@ManID" paramtype="runtime" requestparamname="ManID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@DistID" paramtype="runtime" requestparamname="DistID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@GenreID" paramtype="runtime" requestparamname="GenreID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@VectorID" paramtype="runtime" requestparamname="VectorID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@locale" paramtype="runtime" requestparamname="LocaleSetting" sqlDataType="varchar" defvalue="en-US" validationpattern="" />
<queryparam paramname="@CustLevelID" paramtype="runtime" requestparamname="CustomerLevelID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@AffID" paramtype="runtime" requestparamname="AffiliateID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@ProdTypeID" paramtype="runtime" requestparamname="ProductTypeFilterID" sqlDataType="int" defvalue="1" validationpattern="" />
<queryparam paramname="@pgnum" paramtype="request" requestparamname="pagenum" sqlDataType="int" defvalue="1" validationpattern="" />
<queryparam paramname="@InvFilter" paramtype="appconfig" requestparamname="HideProductsWithLessThanThisInventoryLevel" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@entityname" paramtype="runtime" requestparamname="EntityName" sqlDataType="varchar" defvalue="" validationpattern="" />
</query>
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mynamespace="urn:mynamespace" xmlns:aspdnsf="urn:AjaxPagingControl" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf mynamespace AjaxPagingControl">
<xsl:output method="html" omit-xml-declaration="yes" />
<xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" />
<xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" />
<xsl:param name="ShowSubcatsInGrid">
<xsl:value-of select="aspdnsf:AppConfig('ShowSubcatsInGrid')" />
</xsl:param>
<xsl:param name="SubcatGridCols">
<xsl:value-of select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/ColWidth" />
</xsl:param>
<xsl:param name="EntityName">
<xsl:value-of select="/root/Runtime/EntityName" />
</xsl:param>
<xsl:param name="EntityID">
<xsl:value-of select="/root/Runtime/EntityID" />
</xsl:param>
<xsl:param name="WholesaleOnlySite">
<xsl:value-of select="aspdnsf:AppConfig('WholesaleOnlySite')"/>
</xsl:param>
<xsl:param name="BaseURL">
<xsl:choose>
<xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'category'">c-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
<xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'section'">s-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
<xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'manufacturer'">m-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
<xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'library'">l-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
</xsl:choose>
</xsl:param>
<xsl:param name="CurrentPage">
<xsl:choose>
<xsl:when test="/root/QueryString/pagenum">
<xsl:value-of select="/root/QueryString/pagenum" />
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:template match="/">
<div>
<xsl:value-of select="aspdnsf:EntityPageHeaderDescription($EntityName, $EntityID)" disable-output-escaping="yes" />
</div>
<xsl:value-of select="aspdnsf:EntityPageFilterOptions($EntityName, $EntityID, /root/Runtime/SecID, /root/Runtime/CatID, /root/Runtime/ManID, /root/Runtime/ProductTypeFilterID)" disable-output-escaping="yes" />
<xsl:call-template name="SubEntity" />
<xsl:choose>
<xsl:when test="count(/root/Products/Product) = 0 and count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/Entity) = 0">
<xsl:value-of select="aspdnsf:Topic(concat('empty', /root/Runtime/EntityName, 'text'))" disable-output-escaping="yes" />
</xsl:when>
<xsl:otherwise>
<div style="text-align:right;"><xsl:value-of select="urn:AjaxPagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>
<!--<div style="text-align:right;"><xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>-->
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<TR>
<TD valign="top">
<div id="paginate-top" class="navRange"> </div>
</TD>
</TR>
<xsl:apply-templates select="/root/Products/Product" />
<TR>
<TD>
<div id="paginate-bottom"> </div>
</TD>
</TR>
</table>
<div style="text-align:right;"><xsl:value-of select="urn:AjaxPagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>
<!--<div style="text-align:right;"><xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>-->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="SubEntity">
<xsl:for-each select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]">
<xsl:choose>
<xsl:when test="$ShowSubcatsInGrid = 'true'">
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<xsl:if test="position() mod $SubcatGridCols = 1 or ($SubcatGridCols = 1)">
<tr>
<xsl:for-each select=". | following-sibling::*[position() < $SubcatGridCols]">
<xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)" />
<xsl:call-template name="SubCatCell">
<xsl:with-param name="scName" select="$scName" />
</xsl:call-template>
</xsl:for-each>
</tr>
<tr>
<td height="10" colspan="{$SubcatGridCols}">*</td>
</tr>
</xsl:if>
</table>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)" />
<p align="left">
***<img border="0" src="{concat('skins/skin_', aspdnsf:SkinID(), '/images/redarrow.gif')}"></img>*
<a href="{aspdnsf:EntityLink(EntityID, SEName, $EntityName, 0, '')}">
<xsl:value-of select="$scName" disable-output-escaping="yes"/>
</a>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="SubCatCell">
<xsl:param name="scName"></xsl:param>
<xsl:param name="pSEAltText" select="aspdnsf:GetMLValue(SEAltText)"></xsl:param>
<xsl:param name="AltText">
<xsl:choose>
<xsl:when test="$pSEAltText=''"><xsl:value-of select="$scName" /></xsl:when>
<xsl:otherwise><xsl:value-of select="$pSEAltText" /></xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="URL">
<xsl:value-of select="aspdnsf:EntityLink(EntityID, SEName, $EntityName, 0, '')" />
</xsl:param>
<td align="center">
<a href="{$URL}">
<xsl:value-of select="aspdnsf:LookupEntityImage(EntityID, $EntityName, 'icon', 0, $AltText)" disable-output-escaping="yes" />
</a>
<br/>
<a href="{$URL}">
<xsl:value-of select="$scName" disable-output-escaping="yes"/>
</a>
</td>
</xsl:template>
<xsl:template match="Product">
<xsl:param name="pName" select="aspdnsf:GetMLValue(Name)"></xsl:param>
<xsl:param name="pDescription" select="aspdnsf:GetMLValue(Description)"></xsl:param>
<xsl:param name="pSalesPromptName" select="aspdnsf:GetMLValue(SalesPromptName)"></xsl:param>
<xsl:param name="pSEAltText" select="aspdnsf:GetMLValue(SEAltText)"></xsl:param>
<xsl:param name="AltText">
<xsl:choose>
<xsl:when test="$pSEAltText=''"><xsl:value-of select="$pName" /></xsl:when>
<xsl:otherwise><xsl:value-of select="$pSEAltText" /></xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="URL">
<xsl:value-of select="aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)" disable-output-escaping="yes" />
</xsl:param>
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td width="10%" align="left" valign="top" style="padding-right:10px;">
<a href="{$URL}">
<xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFileNameOverride, SKU, 'icon', 0, $AltText)" disable-output-escaping="yes" />
</a>
</td>
<td valign="top" align="left">
<table width="100%" cellpadding="1" cellspacing="0" border="0">
<tr>
<td class="ProductNameText" align="left" valign="top">
<a href="{$URL}">
<xsl:value-of select="(concat(ManufacturerName,'*',$pName))" disable-output-escaping="yes"/>
<!--<xsl:value-of select="$pName" disable-output-escaping="yes"/>-->
</a>
</td>
</tr>
<!--<tr>
<td align="left" valign="top">
<xsl:value-of select="$pDescription" disable-output-escaping="yes" />
</td>
</tr>-->
<tr>
<td height="20">*</td>
</tr>
<tr>
<td align="left" valign="top">
<xsl:value-of select="aspdnsf:StringResource(concat('show', $EntityName, '.aspx.50'), $LocaleSetting)" disable-output-escaping="yes" />
<xsl:value-of select="ManufacturerName" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<xsl:value-of select="aspdnsf:StringResource(concat('show', $EntityName, '.aspx.51'), $LocaleSetting)" disable-output-escaping="yes" />
<xsl:value-of select="ManufacturerPartNumber" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<xsl:value-of select="aspdnsf:StringResource(concat('show', $EntityName, '.aspx.29'), $LocaleSetting)" disable-output-escaping="yes" />
<xsl:value-of select="SKU" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<xsl:choose>
<xsl:when test="MiscText = 'SHOW INVENTORY'">
<xsl:value-of select="aspdnsf:StringResource('searchadv.aspx.20')" disable-output-escaping="yes" />
<xsl:value-of select="Inventory" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="aspdnsf:StringResource('searchadv.aspx.21')" disable-output-escaping="yes" />
<xsl:choose>
<xsl:when test="number(Inventory)>0">
<xsl:value-of select="aspdnsf:StringResource('searchadv.aspx.5')" disable-output-escaping="yes" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="aspdnsf:StringResource('searchadv.aspx.6')" disable-output-escaping="yes" />
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td align="left" valign="bottom">
<xsl:value-of select="aspdnsf:GetVariantPrice(VariantID, number(HidePriceUntilCart), Price, SalePrice, ExtendedPrice, Points, $pSalesPromptName, TaxClassID)" disable-output-escaping="yes" />
</td>
</tr>
<tr>
<td align="left" valign="bottom">
<xsl:if test="aspdnsf:AppConfigBool('DisplayOutOfStockProducts') = 'true'">
<xsl:value-of select="aspdnsf:DisplayProductStockHint(ProductID, VariantID,'Entity')" disable-output-escaping="yes" />
</xsl:if>
</td>
</tr>
<tr>
<td height="20">*</td>
</tr>
<tr>
<td align="left" valign="bottom">
<xsl:choose>
<xsl:when test="IsAKit = 1 or IsAPack = 1">
<a href="{$URL}">
<img style="cursor:hand;" border="0" src="{concat('skins/skin_', aspdnsf:SkinID(), '/images/moreinfo.gif')}" alt="{aspdnsf:StringResource('image.altText.14', $LocaleSetting)}"></img>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="aspdnsf:AddtoCartForm(ProductID, VariantID, 0, 'left')" disable-output-escaping="yes" />
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="15">
<hr size="1" />
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
</package>
Thank you in advance with this. We are about 1 week out from going live and I would really like to have some type of better paging that what is out of the box with the large amount of pages that there is with our manufacturers.