Integration of Ajax Pagination (http://www.dynamicdrive.com) with AspDotNetStorefront ML 8.0.0.0. This solution is intended for Source Code licensees as it will require recompilation of the solution. The Dynamic Drive code did not integrate seamlessly so alterations to the Javascript were necessary. Refer to attachments for both original (OG) and altered versions.
Add the <DIV> containers where the pagination control should appear within the ....xml.config file, for example within entity.gridwithprices.xml.config.
Code:
<TABLE>
<TR>
<TD valign="top"><div id="paginate-top" class="navRange"> </div></TD>
</TR>
<TR>
<TD>
<!-- YOUR GALLERY CONTENT HERE -->
</TD>
</TR>
<TR>
<TD><div id="paginate-bottom"> </div></TD>
</TR>
</TABLE>
<xsl:value-of select="aspdnsf:AjaxPagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" />
Add the following new function to XSLTExtentionBase.cs and recompile (I use MSBuild since I prefer a plain text editor over the very expensive Visual Studio):
Code:
public virtual 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;
}
It should be possible to derive a non compiled integration as well using the <C:\...\AspDotNetStorefront\Web\App_Code> folder to define a new AjaxPagingControl() function. Obviously the ....xml.config file will need to use an altered namespace when referencing the function, but this is probably a different thread in this forum.