C#/VB.NET Code:
<?xml version="1.0" standalone="yes" ?>
<package version="2.1" displayname="Entity Grid" 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[
SELECT Product.Name, Product.ProductID, Product.SKU, ProductVariant.VariantID, Product.HidePriceUntilCart, ProductVariant.Price,
isnull(ProductVariant.SalePrice,0) SalePrice,ProductVariant.Points,Product.TaxClassID
FROM Product with (nolock)
INNER JOIN ProductVariant ON ProductVariant.ProductID = Product.ProductID
INNER JOIN ProductCategory ON ProductCategory.ProductID = Product.ProductID
INNER JOIN ProductManufacturer ON ProductManufacturer.ProductID = Product.ProductID
WHERE (ProductManufacturer.ManufacturerID = @ManID) AND (ProductCategory.CategoryID = @CatID)
]]>
</sql>
<queryparam paramname="@ManID" paramtype="request" requestparamname="ManID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0" validationpattern="" />
</query>
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
<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:AppConfigBool('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="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<xsl:apply-templates select="/root/Products/Product" />
</table>
<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:variable name="delta">
<xsl:choose>
<xsl:when test="(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]) mod number($SubcatGridCols)) = 0">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number($SubcatGridCols)-(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]) mod number($SubcatGridCols))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rows" select="ceiling(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]) div number($SubcatGridCols))" />
<xsl:for-each select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]">
<xsl:variable name="entityposition" select="position()" />
<xsl:choose>
<xsl:when test="$ShowSubcatsInGrid = 'true'">
<xsl:if test="position() mod $SubcatGridCols = 1 or ($SubcatGridCols = 1)">
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<tr>
<xsl:for-each select=". | following-sibling::*[position() < $SubcatGridCols]">
<xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)"></xsl:variable>
<xsl:call-template name="SubCatCell">
<xsl:with-param name="scName" select="$scName" />
</xsl:call-template>
</xsl:for-each>
<xsl:if test="ceiling($entityposition div number($SubcatGridCols)) = $rows and $delta > 0">
<xsl:call-template name="FillerCells">
<xsl:with-param name="cellCount" select="$delta" />
</xsl:call-template>
</xsl:if>
</tr>
<tr>
<td height="10" colspan="{$SubcatGridCols}"> </td>
</tr>
</table>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)"></xsl:variable>
<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" width="{concat(round(100 div number($SubcatGridCols)),'%')}">
<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:variable name="delta">
<xsl:choose>
<xsl:when test="(count(/root/Products/Product) mod number($SubcatGridCols)) = 0">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number($SubcatGridCols)-(count(/root/Products/Product) mod number($SubcatGridCols))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rows" select="ceiling(count(/root/Products/Product) div number($SubcatGridCols))" />
<xsl:if test="$SubcatGridCols = 1">
<tr>
<xsl:call-template name="ProductCell"></xsl:call-template>
</tr>
</xsl:if>
<xsl:if test="position() mod $SubcatGridCols = 1 and $SubcatGridCols > 1">
<tr>
<xsl:for-each select=". | following-sibling::*[position() < $SubcatGridCols]">
<xsl:call-template name="ProductCell"></xsl:call-template>
</xsl:for-each>
<xsl:if test="ceiling(position() div number($SubcatGridCols)) = $rows and $delta > 0">
<xsl:call-template name="FillerCells">
<xsl:with-param name="cellCount" select="$delta" />
</xsl:call-template>
</xsl:if>
</tr>
</xsl:if>
</xsl:template>
<xsl:template name="ProductCell">
<xsl:param name="pName" select="aspdnsf:GetMLValue(Name)"></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>
<td align="center" valign="bottom" width="{concat(round(100 div number($SubcatGridCols)),'%')}">
<table>
<tr>
<td height="30" align="center" valign="center">
<a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}">
<xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFileNameOverride, SKU, 'icon', 1, $AltText)" disable-output-escaping="yes"/>
</a>
</td>
</tr>
<tr>
<td height="10" align="center" valign="top">
<a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}">
<xsl:value-of select="$pName" disable-output-escaping="yes" />
</a>
</td>
</tr>
<tr>
<td height="45" align="center" valign="top">
<xsl:if test="aspdnsf:AppConfigBool('DisplayOutOfStockProducts') = 'true'">
<xsl:value-of select="aspdnsf:DisplayProductStockHint(ProductID, VariantID,'Entity')" disable-output-escaping="yes" />
</xsl:if>
</td>
</tr>
</table>
</td>
</xsl:template>
<xsl:template name="FillerCells">
<xsl:param name="cellCount"/>
<xsl:param name="CellWidth" select="100 div $SubcatGridCols" />
<td width="{$CellWidth}%"> </td>
<xsl:if test="$cellCount > 1">
<xsl:call-template name="FillerCells">
<xsl:with-param name="cellCount" select="$cellCount - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
</package>
Hopefully that at least points you in the right direction.