<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ASP: Digg Style Pagination Script</title>
	<atom:link href="http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/</link>
	<description>One step to a new evolution</description>
	<lastBuildDate>Fri, 23 Apr 2010 07:13:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Johnny B Good</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-648</link>
		<dc:creator>Johnny B Good</dc:creator>
		<pubDate>Tue, 20 Apr 2010 10:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-648</guid>
		<description>@Ajit Jadhav

If you copy and paste the code, depending on the html editor you use, sometimes the quotations marks won&#039;t copy over properly and you&#039;ll get an error.  So check that.</description>
		<content:encoded><![CDATA[<p>@Ajit Jadhav</p>
<p>If you copy and paste the code, depending on the html editor you use, sometimes the quotations marks won&#8217;t copy over properly and you&#8217;ll get an error.  So check that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajit Jadhav</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-612</link>
		<dc:creator>Ajit Jadhav</dc:creator>
		<pubDate>Tue, 29 Dec 2009 18:21:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-612</guid>
		<description>Hello!
I am getting below
Microsoft VBScript runtime (0x800A000D)
Type mismatch: &#039;CLng&#039;

For page=CLng(Request(&quot;page&quot;))</description>
		<content:encoded><![CDATA[<p>Hello!<br />
I am getting below<br />
Microsoft VBScript runtime (0x800A000D)<br />
Type mismatch: &#8216;CLng&#8217;</p>
<p>For page=CLng(Request(&#8220;page&#8221;))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bigxxt</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-516</link>
		<dc:creator>Bigxxt</dc:creator>
		<pubDate>Wed, 29 Apr 2009 13:13:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-516</guid>
		<description>Hi there people, I have just implemented the code, all seem ok apart from the fact I can show subsequent pages. My statement reads
ps = getPaginationString(page, objrs.RecordCount, numPerPage, 2,&quot;product.asp? foo=bar&quot;)

When I clck the required page say 2, the address bar changes to http://localhost/xxxxxx/product.asp?foo=bar&amp;page=2

The page is not displayed as I get a page not found error.</description>
		<content:encoded><![CDATA[<p>Hi there people, I have just implemented the code, all seem ok apart from the fact I can show subsequent pages. My statement reads<br />
ps = getPaginationString(page, objrs.RecordCount, numPerPage, 2,&#8221;product.asp? foo=bar&#8221;)</p>
<p>When I clck the required page say 2, the address bar changes to <a href="http://localhost/xxxxxx/product.asp?foo=bar&#038;page=2" rel="nofollow">http://localhost/xxxxxx/product.asp?foo=bar&#038;page=2</a></p>
<p>The page is not displayed as I get a page not found error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JOJY</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-515</link>
		<dc:creator>JOJY</dc:creator>
		<pubDate>Wed, 15 Apr 2009 20:26:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-515</guid>
		<description>I have already given the sample code but here is it again.

create connection and recordset obj
set objcon=Server.CreateObject(&quot;ADODB.Connection&quot;)
set objrs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)
objcon.open &quot;....&quot;
countItem = 0
numPerPage = 5
objrs.cursorlocation = 3
if request(&quot;page&quot;) = &quot;&quot; then
   page=1
else
   page=cLng(request(&quot;page&quot;))
end if
objrs.open &quot;SELECT * FROM SOMETABLE&quot;, objcon,1,2
if not objrs.EOF then
  objRs.pageSize = numPerPage
  totalpages = objRs.PageCount
  objRs.absolutePage=page
  while not objrs.EOF AND countItem &lt; objRs.pageSize
     ..... do some stuff here
     countItem = countItem + 1
     objrs.movenext()
  wend
  ps = getPaginationString(page, objrs.RecordCount, numPerPage, 2, &quot;mypage.asp?optional=&quot;&amp;parameter&amp;&quot;&amp;goes=&quot;&amp;here&amp;&quot;&amp;Search=Search&quot;)
  Response.Write(ps)  

end if
... clean things.. conn, record set</description>
		<content:encoded><![CDATA[<p>I have already given the sample code but here is it again.</p>
<p>create connection and recordset obj<br />
set objcon=Server.CreateObject(&#8220;ADODB.Connection&#8221;)<br />
set objrs=Server.CreateObject(&#8220;ADODB.RecordSet&#8221;)<br />
objcon.open &#8220;&#8230;.&#8221;<br />
countItem = 0<br />
numPerPage = 5<br />
objrs.cursorlocation = 3<br />
if request(&#8220;page&#8221;) = &#8220;&#8221; then<br />
   page=1<br />
else<br />
   page=cLng(request(&#8220;page&#8221;))<br />
end if<br />
objrs.open &#8220;SELECT * FROM SOMETABLE&#8221;, objcon,1,2<br />
if not objrs.EOF then<br />
  objRs.pageSize = numPerPage<br />
  totalpages = objRs.PageCount<br />
  objRs.absolutePage=page<br />
  while not objrs.EOF AND countItem < objRs.pageSize<br />
     &#8230;.. do some stuff here<br />
     countItem = countItem + 1<br />
     objrs.movenext()<br />
  wend<br />
  ps = getPaginationString(page, objrs.RecordCount, numPerPage, 2, &#8220;mypage.asp?optional=&#8221;&#038;parameter&#038;&#8221;&#038;goes=&#8221;&#038;here&#038;&#8221;&#038;Search=Search&#8221;)<br />
  Response.Write(ps)  </p>
<p>end if<br />
&#8230; clean things.. conn, record set</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reengineering</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-514</link>
		<dc:creator>reengineering</dc:creator>
		<pubDate>Wed, 15 Apr 2009 18:49:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-514</guid>
		<description>below is the code where i want to past the pagination. can u help me put your best pagination script in there? thank you so much!


&lt;%
&#039;




sFileName = &quot;Default.asp&quot;
sTemplateFileName = &quot;Default.htm&quot;




LoadTemplate sAppPath &amp; sTemplateFileName, &quot;main&quot;

LoadTemplate sHeaderFileName, &quot;Header&quot;


SetVar &quot;FileName&quot;, sFileName


Header_Show
Grid_Show
Search_Show
EmpMonth_Show
Parse &quot;Header&quot;, False
Parse &quot;main&quot;, False
Response.write PrintVar(&quot;main&quot;)


&#039;--------------------------------------------------



Sub Grid_Show()
  
  Dim sWhere
  sWhere = &quot;&quot;
  sOrder = &quot;&quot;
  sSQL = &quot;&quot;
  HasParam = false


  SetVar &quot;TransitParams&quot;, &quot;name=&quot; &amp; ToURL(GetParam(&quot;name&quot;)) &amp; &quot;&amp;dep_id=&quot; &amp; ToURL(GetParam(&quot;dep_id&quot;)) &amp; &quot;&amp;email=&quot; &amp; ToURL(GetParam(&quot;email&quot;)) &amp; &quot;&amp;&quot;
  SetVar &quot;FormParams&quot;, &quot;name=&quot; &amp; ToURL(GetParam(&quot;name&quot;)) &amp; &quot;&amp;dep_id=&quot; &amp; ToURL(GetParam(&quot;dep_id&quot;)) &amp; &quot;&amp;email=&quot; &amp; ToURL(GetParam(&quot;email&quot;)) &amp; &quot;&amp;&quot;
&#039; Build WHERE statement

  pdep_id = GetParam(&quot;dep_id&quot;)
  if IsNumeric(pdep_id) and not isEmpty(pdep_id) then pdep_id = CLng(pdep_id) else pdep_id = Empty
  if not isEmpty(pdep_id) then
    HasParam = true
    sWhere = sWhere &amp; &quot;e.dep_id=&quot; &amp; pdep_id
  end if
  
  pemail = GetParam(&quot;email&quot;)
  if not isEmpty(pemail) then
    if not (sWhere = &quot;&quot;) then sWhere = sWhere &amp; &quot; and &quot;
    HasParam = true
    sWhere = sWhere &amp; &quot;e.email like &#039;%&quot; &amp; replace(pemail, &quot;&#039;&quot;, &quot;&#039;&#039;&quot;) &amp; &quot;%&#039;&quot;
  end if
  
  pname = GetParam(&quot;name&quot;)
  if not isEmpty(pname) then
    if not (sWhere = &quot;&quot;) then sWhere = sWhere &amp; &quot; and &quot;
    HasParam = true
    sWhere = sWhere &amp; &quot;e.name like &#039;%&quot; &amp; replace(pname, &quot;&#039;&quot;, &quot;&#039;&#039;&quot;) &amp; &quot;%&#039;&quot;
  end if
  
  if HasParam then sWhere = &quot; AND (&quot; &amp; sWhere &amp; &quot;)&quot;
  &#039; Build ORDER statement
  sOrder = &quot; order by e.name Asc&quot;
  iSort = GetParam(&quot;FormGrid_Sorting&quot;)
  iSorted = GetParam(&quot;FormGrid_Sorted&quot;)
  sDirection = &quot;&quot;
  if IsEmpty(iSort) then
    SetVar &quot;Form_Sorting&quot;, &quot;&quot;
  else
    if iSort = iSorted then 
      SetVar &quot;Form_Sorting&quot;, &quot;&quot;
      sDirection = &quot; DESC&quot;
      sSortParams = &quot;FormGrid_Sorting=&quot; &amp; iSort &amp; &quot;&amp;FormGrid_Sorted=&quot; &amp; iSort &amp; &quot;&amp;&quot;
    else
      SetVar &quot;Form_Sorting&quot;, iSort
      sDirection = &quot; ASC&quot;
      sSortParams = &quot;FormGrid_Sorting=&quot; &amp; iSort &amp; &quot;&amp;FormGrid_Sorted=&quot; &amp; &quot;&amp;&quot;
    end if
    
    if iSort = 1 then sOrder = &quot; order by e.name&quot; &amp; sDirection
    if iSort = 2 then sOrder = &quot; order by e.title&quot; &amp; sDirection
    if iSort = 3 then sOrder = &quot; order by d.name&quot; &amp; sDirection
    if iSort = 4 then sOrder = &quot; order by e.work_phone&quot; &amp; sDirection
    if iSort = 5 then sOrder = &quot; order by e.email&quot; &amp; sDirection
	if iSort = 6 then sOrder = &quot; order by e.sponsor&quot; &amp; sDirection &#039;added
	if iSort = 7 then sOrder = &quot; order by e.joining_date&quot; &amp; sDirection &#039;added
	if iSort = 8 then sOrder = &quot; order by e.ip&quot; &amp; sDirection &#039;added
  end if
  

  &#039; Build full SQL statement
  
  sSQL = &quot;select e.dep_id as e_dep_id, &quot; &amp; _
    &quot;e.email as e_email, &quot; &amp; _
    &quot;e.emp_id as e_emp_id, &quot; &amp; _
    &quot;e.name as e_name, &quot; &amp; _
    &quot;e.title as e_title, &quot; &amp; _
    &quot;e.work_phone as e_work_phone, &quot; &amp; _
	
	&quot;e.joining_date as e_joining_date, &quot; &amp; _
	&quot;e.ip as e_ip, &quot; &amp; _ 	
	&quot;e.sponsor as e_sponsor, &quot; &amp; _  
    &quot;d.dep_id as d_dep_id, &quot; &amp; _
    &quot;d.name as d_name &quot; &amp; _
	
    &quot; from emps e, deps d&quot; &amp; _
    &quot; where d.dep_id=e.dep_id  &quot;

  sSQL = sSQL &amp; sWhere &amp; sOrder
  SetVar &quot;SortParams&quot;, sSortParams
  
  &#039; Open recordset
  openrs rs, sSQL
  if rs.eof then
    &#039; Recordset is empty
    set rs = nothing
    SetVar &quot;DListGrid&quot;, &quot;&quot;
    Parse &quot;GridNoRecords&quot;, False
    Parse &quot;FormGrid&quot;, False
    exit sub
  end if

  &#039;added pagination
  &#039; Select current page
  iPage = GetParam(&quot;Formemps_Page&quot;)
  if IsEmpty(iPage) then iPage = 1
  &#039; Open recordset
  openrs rs, sSQL
  if rs.eof then
    &#039; Recordset is empty
    set rs = nothing
    SetVar &quot;DListemps&quot;, &quot;&quot;
    Parse &quot;empsNoRecords&quot;, False
    SetVar &quot;empsScroller&quot;, &quot;&quot;
    Parse &quot;Formemps&quot;, False
    exit sub
  end if


  aemp_level = Split(&quot;0;;3;Admin&quot;, &quot;;&quot;)
  amanmonth = Split(&quot;0;;1;Yes&quot;, &quot;;&quot;)
  iCounter = 0
  while not rs.eof and iCounter &lt; (iPage-1)*15
    rs.movenext
		iCounter = iCounter + 1
  wend
  iCounter = 0
  
  
  
  &#039;end pagination
  
  


  &#039; Show main table based on recordset
  while not rs.EOF  and iCounter &lt; 15
    fldname = GetValue(rs, &quot;e_name&quot;)
    fldtitle = GetValue(rs, &quot;e_title&quot;)
    flddep_id = GetValue(rs, &quot;d_name&quot;)
    fldwork_phone = GetValue(rs, &quot;e_work_phone&quot;)
    fldemail = GetValue(rs, &quot;e_email&quot;)
fldemail=&quot;&lt;a&gt;&quot; &amp; fldemail &amp; &quot;&lt;/a&gt;&quot;
    fldsponsor = GetValue(rs,&quot;e_sponsor&quot;)
	fldjoining_date = GetValue(rs,&quot;e_joining_date&quot;)
	fldip = GetValue(rs,&quot;e_ip&quot;)

      SetVar &quot;name&quot;, ToHTML(fldname)
      SetVar &quot;name_URLLink&quot;, &quot;EmpDetail.asp&quot;
      SetVar &quot;Prm_emp_id&quot;, ToURL(GetValue(rs, &quot;e_emp_id&quot;)) 
      SetVar &quot;title&quot;, ToHTML(fldtitle)
      SetVar &quot;dep_id&quot;, ToHTML(flddep_id)
      SetVar &quot;work_phone&quot;, ToHTML(fldwork_phone)
      SetVar &quot;email&quot;, fldemail
	  SetVar &quot;sponsor&quot;, ToHTML(fldsponsor)
      SetVar &quot;joining_date&quot;, ToHTML(fldjoining_date)
	  SetVar &quot;ip&quot;, ToHTML(fldip)  	  

    Parse &quot;DListGrid&quot;, True
    
    rs.MoveNext
	&#039;added
	iCounter = iCounter + 1
    &#039;end added
  wend

    &#039;added
	
	&#039; Parse scroller
  if rs.EOF and iPage = 1 then
    SetVar &quot;empsScroller&quot;, &quot;&quot;
  else
    if rs.EOF then 
      SetVar &quot;empsScrollerNextSwitch&quot;, &quot;_&quot;
    else
      SetVar &quot;NextPage&quot;, (iPage + 1)
      SetVar &quot;empsScrollerNextSwitch&quot;, &quot;&quot;
    end if

    if iPage = 1 then
      SetVar &quot;empsScrollerPrevSwitch&quot;, &quot;_&quot;
    else
      SetVar &quot;PrevPage&quot;, (iPage - 1)
      SetVar &quot;empsScrollerPrevSwitch&quot;, &quot;&quot;
    end if

    SetVar &quot;empsCurrentPage&quot;, iPage
    Parse &quot;empsScroller&quot;, False
  end if
	
	&#039;end added
    
  

  set rs = nothing
  SetVar &quot;GridNoRecords&quot;, &quot;&quot;
  Parse &quot;FormGrid&quot;, False
  
End Sub



Sub Search_Show()
      
      SetVar &quot;ActionPage&quot;, &quot;Default.asp&quot;

      &#039; Set variables with search parameters
      
      flddep_id = GetParam(&quot;dep_id&quot;)
      fldname = GetParam(&quot;name&quot;)
      fldemail = GetParam(&quot;email&quot;)
      &#039; Show fields
      

      SetVar &quot;LBdep_id&quot;, &quot;&quot;
      SetVar &quot;ID&quot;, &quot;&quot;
      SetVar &quot;Value&quot;, &quot;All&quot;
      Parse &quot;LBdep_id&quot;, True
      openrs rsdep_id, &quot;select dep_id, name from deps order by 2&quot;
      while not rsdep_id.EOF
        SetVar &quot;ID&quot;, GetValue(rsdep_id, 0) : SetVar &quot;Value&quot;, GetValue(rsdep_id, 1)
        if cstr(GetValue(rsdep_id, 0)) = cstr(flddep_id) then SetVar &quot;Selected&quot;, &quot;SELECTED&quot; else SetVar &quot;Selected&quot;, &quot;&quot;
        Parse &quot;LBdep_id&quot;, True
        rsdep_id.MoveNext
      wend
      set rsdep_id = nothing
    
      SetVar &quot;name&quot;, ToHTML(fldname)
      SetVar &quot;email&quot;, ToHTML(fldemail)
      Parse &quot;FormSearch&quot;, False
End Sub



Sub EmpMonth_Show()
  
  Dim sWhere
  sWhere = &quot;&quot;
  sOrder = &quot;&quot;
  sSQL = &quot;&quot;
  HasParam = false


  SetVar &quot;TransitParams&quot;, &quot;&quot;
  SetVar &quot;FormParams&quot;, &quot;&quot;
&#039; Build WHERE statement

  sWhere = &quot; WHERE manmonth=1&quot;
  

  &#039; Build full SQL statement
  
  sSQL = &quot;select e.name as e_name, &quot; &amp; _
    &quot;e.picture as e_picture &quot; &amp; _
    &quot; from emps e &quot;

  sSQL = sSQL &amp; sWhere &amp; sOrder
  &#039; Open recordset
  openrs rs, sSQL
  if rs.eof then
    &#039; Recordset is empty
    set rs = nothing
    SetVar &quot;DListEmpMonth&quot;, &quot;&quot;
    Parse &quot;EmpMonthNoRecords&quot;, False
    Parse &quot;FormEmpMonth&quot;, False
    exit sub
  end if



  &#039; Show main table based on recordset
  while not rs.EOF 
    fldpicture = GetValue(rs, &quot;e_picture&quot;)
    fldname = GetValue(rs, &quot;e_name&quot;)
	flddep_id = GetValue (rs, &quot;d_name&quot;)
fldpicture=&quot;&quot;

      SetVar &quot;picture&quot;, fldpicture
      SetVar &quot;name&quot;, ToHTML(fldname)
      SetVar &quot;d_name&quot;, ToHTML(fldd_name)
    Parse &quot;DListEmpMonth&quot;, True
    
    rs.MoveNext

  wend


  set rs = nothing
  SetVar &quot;EmpMonthNoRecords&quot;, &quot;&quot;
  Parse &quot;FormEmpMonth&quot;, False
  
End Sub

%&gt;</description>
		<content:encoded><![CDATA[<p>below is the code where i want to past the pagination. can u help me put your best pagination script in there? thank you so much!</p>
<p>&lt;%<br />
&#8216;</p>
<p>sFileName = &#8220;Default.asp&#8221;<br />
sTemplateFileName = &#8220;Default.htm&#8221;</p>
<p>LoadTemplate sAppPath &amp; sTemplateFileName, &#8220;main&#8221;</p>
<p>LoadTemplate sHeaderFileName, &#8220;Header&#8221;</p>
<p>SetVar &#8220;FileName&#8221;, sFileName</p>
<p>Header_Show<br />
Grid_Show<br />
Search_Show<br />
EmpMonth_Show<br />
Parse &#8220;Header&#8221;, False<br />
Parse &#8220;main&#8221;, False<br />
Response.write PrintVar(&#8220;main&#8221;)</p>
<p>&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Sub Grid_Show()</p>
<p>  Dim sWhere<br />
  sWhere = &#8220;&#8221;<br />
  sOrder = &#8220;&#8221;<br />
  sSQL = &#8220;&#8221;<br />
  HasParam = false</p>
<p>  SetVar &#8220;TransitParams&#8221;, &#8220;name=&#8221; &amp; ToURL(GetParam(&#8220;name&#8221;)) &amp; &#8220;&amp;dep_id=&#8221; &amp; ToURL(GetParam(&#8220;dep_id&#8221;)) &amp; &#8220;&amp;email=&#8221; &amp; ToURL(GetParam(&#8220;email&#8221;)) &amp; &#8220;&amp;&#8221;<br />
  SetVar &#8220;FormParams&#8221;, &#8220;name=&#8221; &amp; ToURL(GetParam(&#8220;name&#8221;)) &amp; &#8220;&amp;dep_id=&#8221; &amp; ToURL(GetParam(&#8220;dep_id&#8221;)) &amp; &#8220;&amp;email=&#8221; &amp; ToURL(GetParam(&#8220;email&#8221;)) &amp; &#8220;&amp;&#8221;<br />
&#8216; Build WHERE statement</p>
<p>  pdep_id = GetParam(&#8220;dep_id&#8221;)<br />
  if IsNumeric(pdep_id) and not isEmpty(pdep_id) then pdep_id = CLng(pdep_id) else pdep_id = Empty<br />
  if not isEmpty(pdep_id) then<br />
    HasParam = true<br />
    sWhere = sWhere &amp; &#8220;e.dep_id=&#8221; &amp; pdep_id<br />
  end if</p>
<p>  pemail = GetParam(&#8220;email&#8221;)<br />
  if not isEmpty(pemail) then<br />
    if not (sWhere = &#8220;&#8221;) then sWhere = sWhere &amp; &#8221; and &#8221;<br />
    HasParam = true<br />
    sWhere = sWhere &amp; &#8220;e.email like &#8216;%&#8221; &amp; replace(pemail, &#8220;&#8216;&#8221;, &#8220;&#8221;&#8221;) &amp; &#8220;%&#8217;&#8221;<br />
  end if</p>
<p>  pname = GetParam(&#8220;name&#8221;)<br />
  if not isEmpty(pname) then<br />
    if not (sWhere = &#8220;&#8221;) then sWhere = sWhere &amp; &#8221; and &#8221;<br />
    HasParam = true<br />
    sWhere = sWhere &amp; &#8220;e.name like &#8216;%&#8221; &amp; replace(pname, &#8220;&#8216;&#8221;, &#8220;&#8221;&#8221;) &amp; &#8220;%&#8217;&#8221;<br />
  end if</p>
<p>  if HasParam then sWhere = &#8221; AND (&#8221; &amp; sWhere &amp; &#8220;)&#8221;<br />
  &#8216; Build ORDER statement<br />
  sOrder = &#8221; order by e.name Asc&#8221;<br />
  iSort = GetParam(&#8220;FormGrid_Sorting&#8221;)<br />
  iSorted = GetParam(&#8220;FormGrid_Sorted&#8221;)<br />
  sDirection = &#8220;&#8221;<br />
  if IsEmpty(iSort) then<br />
    SetVar &#8220;Form_Sorting&#8221;, &#8220;&#8221;<br />
  else<br />
    if iSort = iSorted then<br />
      SetVar &#8220;Form_Sorting&#8221;, &#8220;&#8221;<br />
      sDirection = &#8221; DESC&#8221;<br />
      sSortParams = &#8220;FormGrid_Sorting=&#8221; &amp; iSort &amp; &#8220;&amp;FormGrid_Sorted=&#8221; &amp; iSort &amp; &#8220;&amp;&#8221;<br />
    else<br />
      SetVar &#8220;Form_Sorting&#8221;, iSort<br />
      sDirection = &#8221; ASC&#8221;<br />
      sSortParams = &#8220;FormGrid_Sorting=&#8221; &amp; iSort &amp; &#8220;&amp;FormGrid_Sorted=&#8221; &amp; &#8220;&amp;&#8221;<br />
    end if</p>
<p>    if iSort = 1 then sOrder = &#8221; order by e.name&#8221; &amp; sDirection<br />
    if iSort = 2 then sOrder = &#8221; order by e.title&#8221; &amp; sDirection<br />
    if iSort = 3 then sOrder = &#8221; order by d.name&#8221; &amp; sDirection<br />
    if iSort = 4 then sOrder = &#8221; order by e.work_phone&#8221; &amp; sDirection<br />
    if iSort = 5 then sOrder = &#8221; order by e.email&#8221; &amp; sDirection<br />
	if iSort = 6 then sOrder = &#8221; order by e.sponsor&#8221; &amp; sDirection &#8216;added<br />
	if iSort = 7 then sOrder = &#8221; order by e.joining_date&#8221; &amp; sDirection &#8216;added<br />
	if iSort = 8 then sOrder = &#8221; order by e.ip&#8221; &amp; sDirection &#8216;added<br />
  end if</p>
<p>  &#8216; Build full SQL statement</p>
<p>  sSQL = &#8220;select e.dep_id as e_dep_id, &#8221; &amp; _<br />
    &#8220;e.email as e_email, &#8221; &amp; _<br />
    &#8220;e.emp_id as e_emp_id, &#8221; &amp; _<br />
    &#8220;e.name as e_name, &#8221; &amp; _<br />
    &#8220;e.title as e_title, &#8221; &amp; _<br />
    &#8220;e.work_phone as e_work_phone, &#8221; &amp; _</p>
<p>	&#8220;e.joining_date as e_joining_date, &#8221; &amp; _<br />
	&#8220;e.ip as e_ip, &#8221; &amp; _<br />
	&#8220;e.sponsor as e_sponsor, &#8221; &amp; _<br />
    &#8220;d.dep_id as d_dep_id, &#8221; &amp; _<br />
    &#8220;d.name as d_name &#8221; &amp; _</p>
<p>    &#8221; from emps e, deps d&#8221; &amp; _<br />
    &#8221; where d.dep_id=e.dep_id  &#8221;</p>
<p>  sSQL = sSQL &amp; sWhere &amp; sOrder<br />
  SetVar &#8220;SortParams&#8221;, sSortParams</p>
<p>  &#8216; Open recordset<br />
  openrs rs, sSQL<br />
  if rs.eof then<br />
    &#8216; Recordset is empty<br />
    set rs = nothing<br />
    SetVar &#8220;DListGrid&#8221;, &#8220;&#8221;<br />
    Parse &#8220;GridNoRecords&#8221;, False<br />
    Parse &#8220;FormGrid&#8221;, False<br />
    exit sub<br />
  end if</p>
<p>  &#8216;added pagination<br />
  &#8216; Select current page<br />
  iPage = GetParam(&#8220;Formemps_Page&#8221;)<br />
  if IsEmpty(iPage) then iPage = 1<br />
  &#8216; Open recordset<br />
  openrs rs, sSQL<br />
  if rs.eof then<br />
    &#8216; Recordset is empty<br />
    set rs = nothing<br />
    SetVar &#8220;DListemps&#8221;, &#8220;&#8221;<br />
    Parse &#8220;empsNoRecords&#8221;, False<br />
    SetVar &#8220;empsScroller&#8221;, &#8220;&#8221;<br />
    Parse &#8220;Formemps&#8221;, False<br />
    exit sub<br />
  end if</p>
<p>  aemp_level = Split(&#8220;0;;3;Admin&#8221;, &#8220;;&#8221;)<br />
  amanmonth = Split(&#8220;0;;1;Yes&#8221;, &#8220;;&#8221;)<br />
  iCounter = 0<br />
  while not rs.eof and iCounter &lt; (iPage-1)*15<br />
    rs.movenext<br />
		iCounter = iCounter + 1<br />
  wend<br />
  iCounter = 0</p>
<p>  &#8216;end pagination</p>
<p>  &#8216; Show main table based on recordset<br />
  while not rs.EOF  and iCounter &lt; 15<br />
    fldname = GetValue(rs, &#8220;e_name&#8221;)<br />
    fldtitle = GetValue(rs, &#8220;e_title&#8221;)<br />
    flddep_id = GetValue(rs, &#8220;d_name&#8221;)<br />
    fldwork_phone = GetValue(rs, &#8220;e_work_phone&#8221;)<br />
    fldemail = GetValue(rs, &#8220;e_email&#8221;)<br />
fldemail=&#8221;<a>&#8221; &amp; fldemail &amp; &#8220;</a>&#8221;<br />
    fldsponsor = GetValue(rs,&#8221;e_sponsor&#8221;)<br />
	fldjoining_date = GetValue(rs,&#8221;e_joining_date&#8221;)<br />
	fldip = GetValue(rs,&#8221;e_ip&#8221;)</p>
<p>      SetVar &#8220;name&#8221;, ToHTML(fldname)<br />
      SetVar &#8220;name_URLLink&#8221;, &#8220;EmpDetail.asp&#8221;<br />
      SetVar &#8220;Prm_emp_id&#8221;, ToURL(GetValue(rs, &#8220;e_emp_id&#8221;))<br />
      SetVar &#8220;title&#8221;, ToHTML(fldtitle)<br />
      SetVar &#8220;dep_id&#8221;, ToHTML(flddep_id)<br />
      SetVar &#8220;work_phone&#8221;, ToHTML(fldwork_phone)<br />
      SetVar &#8220;email&#8221;, fldemail<br />
	  SetVar &#8220;sponsor&#8221;, ToHTML(fldsponsor)<br />
      SetVar &#8220;joining_date&#8221;, ToHTML(fldjoining_date)<br />
	  SetVar &#8220;ip&#8221;, ToHTML(fldip)  	  </p>
<p>    Parse &#8220;DListGrid&#8221;, True</p>
<p>    rs.MoveNext<br />
	&#8216;added<br />
	iCounter = iCounter + 1<br />
    &#8216;end added<br />
  wend</p>
<p>    &#8216;added</p>
<p>	&#8216; Parse scroller<br />
  if rs.EOF and iPage = 1 then<br />
    SetVar &#8220;empsScroller&#8221;, &#8220;&#8221;<br />
  else<br />
    if rs.EOF then<br />
      SetVar &#8220;empsScrollerNextSwitch&#8221;, &#8220;_&#8221;<br />
    else<br />
      SetVar &#8220;NextPage&#8221;, (iPage + 1)<br />
      SetVar &#8220;empsScrollerNextSwitch&#8221;, &#8220;&#8221;<br />
    end if</p>
<p>    if iPage = 1 then<br />
      SetVar &#8220;empsScrollerPrevSwitch&#8221;, &#8220;_&#8221;<br />
    else<br />
      SetVar &#8220;PrevPage&#8221;, (iPage &#8211; 1)<br />
      SetVar &#8220;empsScrollerPrevSwitch&#8221;, &#8220;&#8221;<br />
    end if</p>
<p>    SetVar &#8220;empsCurrentPage&#8221;, iPage<br />
    Parse &#8220;empsScroller&#8221;, False<br />
  end if</p>
<p>	&#8216;end added</p>
<p>  set rs = nothing<br />
  SetVar &#8220;GridNoRecords&#8221;, &#8220;&#8221;<br />
  Parse &#8220;FormGrid&#8221;, False</p>
<p>End Sub</p>
<p>Sub Search_Show()</p>
<p>      SetVar &#8220;ActionPage&#8221;, &#8220;Default.asp&#8221;</p>
<p>      &#8216; Set variables with search parameters</p>
<p>      flddep_id = GetParam(&#8220;dep_id&#8221;)<br />
      fldname = GetParam(&#8220;name&#8221;)<br />
      fldemail = GetParam(&#8220;email&#8221;)<br />
      &#8216; Show fields</p>
<p>      SetVar &#8220;LBdep_id&#8221;, &#8220;&#8221;<br />
      SetVar &#8220;ID&#8221;, &#8220;&#8221;<br />
      SetVar &#8220;Value&#8221;, &#8220;All&#8221;<br />
      Parse &#8220;LBdep_id&#8221;, True<br />
      openrs rsdep_id, &#8220;select dep_id, name from deps order by 2&#8243;<br />
      while not rsdep_id.EOF<br />
        SetVar &#8220;ID&#8221;, GetValue(rsdep_id, 0) : SetVar &#8220;Value&#8221;, GetValue(rsdep_id, 1)<br />
        if cstr(GetValue(rsdep_id, 0)) = cstr(flddep_id) then SetVar &#8220;Selected&#8221;, &#8220;SELECTED&#8221; else SetVar &#8220;Selected&#8221;, &#8220;&#8221;<br />
        Parse &#8220;LBdep_id&#8221;, True<br />
        rsdep_id.MoveNext<br />
      wend<br />
      set rsdep_id = nothing</p>
<p>      SetVar &#8220;name&#8221;, ToHTML(fldname)<br />
      SetVar &#8220;email&#8221;, ToHTML(fldemail)<br />
      Parse &#8220;FormSearch&#8221;, False<br />
End Sub</p>
<p>Sub EmpMonth_Show()</p>
<p>  Dim sWhere<br />
  sWhere = &#8220;&#8221;<br />
  sOrder = &#8220;&#8221;<br />
  sSQL = &#8220;&#8221;<br />
  HasParam = false</p>
<p>  SetVar &#8220;TransitParams&#8221;, &#8220;&#8221;<br />
  SetVar &#8220;FormParams&#8221;, &#8220;&#8221;<br />
&#8216; Build WHERE statement</p>
<p>  sWhere = &#8221; WHERE manmonth=1&#8243;</p>
<p>  &#8216; Build full SQL statement</p>
<p>  sSQL = &#8220;select e.name as e_name, &#8221; &amp; _<br />
    &#8220;e.picture as e_picture &#8221; &amp; _<br />
    &#8221; from emps e &#8221;</p>
<p>  sSQL = sSQL &amp; sWhere &amp; sOrder<br />
  &#8216; Open recordset<br />
  openrs rs, sSQL<br />
  if rs.eof then<br />
    &#8216; Recordset is empty<br />
    set rs = nothing<br />
    SetVar &#8220;DListEmpMonth&#8221;, &#8220;&#8221;<br />
    Parse &#8220;EmpMonthNoRecords&#8221;, False<br />
    Parse &#8220;FormEmpMonth&#8221;, False<br />
    exit sub<br />
  end if</p>
<p>  &#8216; Show main table based on recordset<br />
  while not rs.EOF<br />
    fldpicture = GetValue(rs, &#8220;e_picture&#8221;)<br />
    fldname = GetValue(rs, &#8220;e_name&#8221;)<br />
	flddep_id = GetValue (rs, &#8220;d_name&#8221;)<br />
fldpicture=&#8221;"</p>
<p>      SetVar &#8220;picture&#8221;, fldpicture<br />
      SetVar &#8220;name&#8221;, ToHTML(fldname)<br />
      SetVar &#8220;d_name&#8221;, ToHTML(fldd_name)<br />
    Parse &#8220;DListEmpMonth&#8221;, True</p>
<p>    rs.MoveNext</p>
<p>  wend</p>
<p>  set rs = nothing<br />
  SetVar &#8220;EmpMonthNoRecords&#8221;, &#8220;&#8221;<br />
  Parse &#8220;FormEmpMonth&#8221;, False</p>
<p>End Sub</p>
<p>%&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Goodkat</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-513</link>
		<dc:creator>Goodkat</dc:creator>
		<pubDate>Mon, 10 Nov 2008 08:42:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-513</guid>
		<description>Hi! Tell me please, what does function parameters means?
&quot;getPaginationString(page, totalitems, limit, adjacents, targetpage)&quot;

page - current page
totalitems - whole amount of pages in Recordset
limit - ?
adjacents - ?
targetpage - link to page.</description>
		<content:encoded><![CDATA[<p>Hi! Tell me please, what does function parameters means?<br />
&#8220;getPaginationString(page, totalitems, limit, adjacents, targetpage)&#8221;</p>
<p>page &#8211; current page<br />
totalitems &#8211; whole amount of pages in Recordset<br />
limit &#8211; ?<br />
adjacents &#8211; ?<br />
targetpage &#8211; link to page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Monie</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-510</link>
		<dc:creator>Monie</dc:creator>
		<pubDate>Tue, 19 Aug 2008 11:36:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-510</guid>
		<description>Ahh... thanks man for the great example! Well perhaps you could do the same tutorian with JQuery? That would be lovely!
Thanks...</description>
		<content:encoded><![CDATA[<p>Ahh&#8230; thanks man for the great example! Well perhaps you could do the same tutorian with JQuery? That would be lovely!<br />
Thanks&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Monie</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-507</link>
		<dc:creator>Monie</dc:creator>
		<pubDate>Thu, 07 Aug 2008 10:15:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-507</guid>
		<description>Hey mate!
Can we have a more detail explaination that uses a real database in the example.
I am having a nightmare using this code :)
Thanks..</description>
		<content:encoded><![CDATA[<p>Hey mate!<br />
Can we have a more detail explaination that uses a real database in the example.<br />
I am having a nightmare using this code <img src='http://www.moazam.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Thanks..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: monie</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-506</link>
		<dc:creator>monie</dc:creator>
		<pubDate>Tue, 05 Aug 2008 04:54:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-506</guid>
		<description>Hey mate, I really liked what you do with the script and I am dying to make it work on my ASP-MySQL page. I did manage to make it work on my PHP-MySQL page but not in my ASP page. Could you help me by giving an example on the working script together with the real data from the database? Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hey mate, I really liked what you do with the script and I am dying to make it work on my ASP-MySQL page. I did manage to make it work on my PHP-MySQL page but not in my ASP page. Could you help me by giving an example on the working script together with the real data from the database? Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sushant</title>
		<link>http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-499</link>
		<dc:creator>Sushant</dc:creator>
		<pubDate>Wed, 26 Mar 2008 07:02:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/#comment-499</guid>
		<description>Please put a full functional asp sample code..instead of putting in parts like Mr. Jovanky De Los Santos ...for newbies
thanks in advance</description>
		<content:encoded><![CDATA[<p>Please put a full functional asp sample code..instead of putting in parts like Mr. Jovanky De Los Santos &#8230;for newbies<br />
thanks in advance</p>
]]></content:encoded>
	</item>
</channel>
</rss>

