<?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: Digg style custom paging for GridViews in ASP.NET</title>
	<atom:link href="http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/</link>
	<description>picking up where teh rest leave off</description>
	<lastBuildDate>Tue, 08 Dec 2009 11:48:18 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: hem</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-14364</link>
		<dc:creator>hem</dc:creator>
		<pubDate>Tue, 08 Dec 2009 11:48:18 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-14364</guid>
		<description>can u please tell me how to do this coding with datalist
thanks in advance 
please  give me source code for that</description>
		<content:encoded><![CDATA[<p>can u please tell me how to do this coding with datalist<br />
thanks in advance<br />
please  give me source code for that</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gökhan</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-14337</link>
		<dc:creator>Gökhan</dc:creator>
		<pubDate>Tue, 26 May 2009 00:53:34 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-14337</guid>
		<description>Great thank you</description>
		<content:encoded><![CDATA[<p>Great thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raja</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-14063</link>
		<dc:creator>raja</dc:creator>
		<pubDate>Wed, 06 Aug 2008 19:21:52 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-14063</guid>
		<description>hello

Great job ......

how can use this code ASP.net Ajax enabled paging , should convert the querystring process to postback ?

code sample please

thanks in advance</description>
		<content:encoded><![CDATA[<p>hello</p>
<p>Great job &#8230;&#8230;</p>
<p>how can use this code ASP.net Ajax enabled paging , should convert the querystring process to postback ?</p>
<p>code sample please</p>
<p>thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck snyder</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-3376</link>
		<dc:creator>Chuck snyder</dc:creator>
		<pubDate>Wed, 11 Jul 2007 20:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-3376</guid>
		<description>I see there is a text length limit.  So, here&#039;s the rest of the vb.net code:
Private Function GetPreviousControl() As Control
	If Me.gridView.PageIndex </description>
		<content:encoded><![CDATA[<p>I see there is a text length limit.  So, here&#8217;s the rest of the vb.net code:<br />
Private Function GetPreviousControl() As Control<br />
	If Me.gridView.PageIndex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck snyder</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-3234</link>
		<dc:creator>Chuck snyder</dc:creator>
		<pubDate>Fri, 06 Jul 2007 20:46:33 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-3234</guid>
		<description>Ahhha, with a little tweaking it works just fine.  Here is the code converted to VB

Partial Class _Default
    Inherits System.Web.UI.Page


    Private Const NEXT_PREVIOUS_CLASS As String = &quot;nextprev&quot;
    Private Const CURRENT_CLASS As String = &quot;current&quot;
    Private Const PREVIOUS_TEXT As String = &quot;&#171; Previous&quot;
    Private Const NEXT_TEXT As String = &quot;Next &#187;&quot;

    Dim AllowMultiColumnSorting As Boolean = True

    Dim sortExpression As String


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Me.CurrentPage &gt; 0 Then
            Me.Gridview1.PageIndex = Me.CurrentPage - 1
        Else
            Me.Gridview1.PageIndex = 0
        End If

    End Sub

	
	#Region &quot;Paging Procedures&quot;

    
    Private ReadOnly Property CurrentPage() As Integer
        Get
            Dim thispage As Integer
            If Not IsNothing(thispage) Then
                thispage = Convert.ToInt32(Request.QueryString(&quot;Page&quot;))
                If thispage = 0 Then
                    thispage += 1
                End If
            End If

            Return thispage
        End Get
    End Property

    Protected Sub Gridview1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
        Dim container As Panel = DirectCast(Gridview1.BottomPagerRow.FindControl(&quot;pagingContainer&quot;), Panel)
        container.Controls.Add(GetPreviousControl())
        Me.AddMainPaging(container)
        container.Controls.Add(GetNextControl())
    End Sub

    Private Sub AddMainPaging(ByVal container As Panel)
        &#039; the number of pages to display 
        &#039; around the currently selected page
        Dim adjacents As Integer = 3

        &#039; don&#039;t need to break it up
        If Gridview1.PageCount  Me.CurrentPage AndAlso Me.CurrentPage &gt; (adjacents * 2) Then
                &#039; hide on both sides
                Me.AddFirstTwo(container)
                Me.AddRange(Me.CurrentPage - adjacents, Me.CurrentPage + adjacents, container)
                Me.AddLastTwo(container)
            Else
                &#039; hide just the beginning
                Me.AddFirstTwo(container)
                Me.AddRange(Gridview1.PageCount - (2 + (adjacents * 2)), Gridview1.PageCount, container)
            End If
        End If
    End Sub

    Private Sub AddDots(ByVal container As Panel)
        Dim dots As New Label()
        dots.Text = &quot;&#8230;.&quot;
        container.Controls.Add(dots)
    End Sub

    Private Sub AddFirstTwo(ByVal container As Panel)
        Me.AddRange(1, 2, container)
        Me.AddDots(container)
    End Sub

    Private Sub AddLastTwo(ByVal container As Panel)
        Me.AddDots(container)
        Me.AddRange(Me.Gridview1.PageCount - 1, Me.Gridview1.PageCount, container)
    End Sub

    Private Sub AddRange(ByVal startIndex As Integer, ByVal endIndex As Integer, ByVal container As Panel)
        For i As Integer = startIndex To endIndex
            container.Controls.Add(Me.GetMainControl(i))
        Next
    End Sub

    Private Function GetMainControl(ByVal currentIndex As Integer) As Control
        If Gridview1.PageIndex + 1 = currentIndex Then
            Return GetLabel(currentIndex.ToString(), CURRENT_CLASS)
        Else
            Return GetHyperLink(currentIndex.ToString(), Nothing, String.Format(&quot;~/Default.aspx?Page={0}&quot;, currentIndex))
        End If
    End Function

    Private Function GetPreviousControl() As Control
        If Me.Gridview1.PageIndex </description>
		<content:encoded><![CDATA[<p>Ahhha, with a little tweaking it works just fine.  Here is the code converted to VB</p>
<p>Partial Class _Default<br />
    Inherits System.Web.UI.Page</p>
<p>    Private Const NEXT_PREVIOUS_CLASS As String = &#8220;nextprev&#8221;<br />
    Private Const CURRENT_CLASS As String = &#8220;current&#8221;<br />
    Private Const PREVIOUS_TEXT As String = &#8220;&#171; Previous&#8221;<br />
    Private Const NEXT_TEXT As String = &#8220;Next &#187;&#8221;</p>
<p>    Dim AllowMultiColumnSorting As Boolean = True</p>
<p>    Dim sortExpression As String</p>
<p>    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load</p>
<p>        If Me.CurrentPage &gt; 0 Then<br />
            Me.Gridview1.PageIndex = Me.CurrentPage &#8211; 1<br />
        Else<br />
            Me.Gridview1.PageIndex = 0<br />
        End If</p>
<p>    End Sub</p>
<p>	#Region &#8220;Paging Procedures&#8221;</p>
<p>    Private ReadOnly Property CurrentPage() As Integer<br />
        Get<br />
            Dim thispage As Integer<br />
            If Not IsNothing(thispage) Then<br />
                thispage = Convert.ToInt32(Request.QueryString(&#8221;Page&#8221;))<br />
                If thispage = 0 Then<br />
                    thispage += 1<br />
                End If<br />
            End If</p>
<p>            Return thispage<br />
        End Get<br />
    End Property</p>
<p>    Protected Sub Gridview1_DataBound(ByVal sender As Object, ByVal e As EventArgs)<br />
        Dim container As Panel = DirectCast(Gridview1.BottomPagerRow.FindControl(&#8221;pagingContainer&#8221;), Panel)<br />
        container.Controls.Add(GetPreviousControl())<br />
        Me.AddMainPaging(container)<br />
        container.Controls.Add(GetNextControl())<br />
    End Sub</p>
<p>    Private Sub AddMainPaging(ByVal container As Panel)<br />
        &#8216; the number of pages to display<br />
        &#8216; around the currently selected page<br />
        Dim adjacents As Integer = 3</p>
<p>        &#8216; don&#8217;t need to break it up<br />
        If Gridview1.PageCount  Me.CurrentPage AndAlso Me.CurrentPage &gt; (adjacents * 2) Then<br />
                &#8216; hide on both sides<br />
                Me.AddFirstTwo(container)<br />
                Me.AddRange(Me.CurrentPage &#8211; adjacents, Me.CurrentPage + adjacents, container)<br />
                Me.AddLastTwo(container)<br />
            Else<br />
                &#8216; hide just the beginning<br />
                Me.AddFirstTwo(container)<br />
                Me.AddRange(Gridview1.PageCount &#8211; (2 + (adjacents * 2)), Gridview1.PageCount, container)<br />
            End If<br />
        End If<br />
    End Sub</p>
<p>    Private Sub AddDots(ByVal container As Panel)<br />
        Dim dots As New Label()<br />
        dots.Text = &#8220;&#8230;.&#8221;<br />
        container.Controls.Add(dots)<br />
    End Sub</p>
<p>    Private Sub AddFirstTwo(ByVal container As Panel)<br />
        Me.AddRange(1, 2, container)<br />
        Me.AddDots(container)<br />
    End Sub</p>
<p>    Private Sub AddLastTwo(ByVal container As Panel)<br />
        Me.AddDots(container)<br />
        Me.AddRange(Me.Gridview1.PageCount &#8211; 1, Me.Gridview1.PageCount, container)<br />
    End Sub</p>
<p>    Private Sub AddRange(ByVal startIndex As Integer, ByVal endIndex As Integer, ByVal container As Panel)<br />
        For i As Integer = startIndex To endIndex<br />
            container.Controls.Add(Me.GetMainControl(i))<br />
        Next<br />
    End Sub</p>
<p>    Private Function GetMainControl(ByVal currentIndex As Integer) As Control<br />
        If Gridview1.PageIndex + 1 = currentIndex Then<br />
            Return GetLabel(currentIndex.ToString(), CURRENT_CLASS)<br />
        Else<br />
            Return GetHyperLink(currentIndex.ToString(), Nothing, String.Format(&#8221;~/Default.aspx?Page={0}&#8221;, currentIndex))<br />
        End If<br />
    End Function</p>
<p>    Private Function GetPreviousControl() As Control<br />
        If Me.Gridview1.PageIndex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck snyder</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-3232</link>
		<dc:creator>Chuck snyder</dc:creator>
		<pubDate>Fri, 06 Jul 2007 19:27:02 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-3232</guid>
		<description>Wow, that&#039;s much nicer than the standard numbers.   I&#039;ll give it a try in my current project.

Thanks for the work.

chuck</description>
		<content:encoded><![CDATA[<p>Wow, that&#8217;s much nicer than the standard numbers.   I&#8217;ll give it a try in my current project.</p>
<p>Thanks for the work.</p>
<p>chuck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gaskell.org &#187; Now with 100% more .net</title>
		<link>http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/comment-page-1/#comment-2936</link>
		<dc:creator>gaskell.org &#187; Now with 100% more .net</dc:creator>
		<pubDate>Thu, 19 Apr 2007 03:47:01 +0000</pubDate>
		<guid isPermaLink="false">http://gaskell.org/digg-style-custom-paging-for-gridviews-in-aspnet/#comment-2936</guid>
		<description>[...] get things started here&#8217;s a live demo of the digg style paging in asp.net project I created.       &#160;    del.icio.us [...]</description>
		<content:encoded><![CDATA[<p>[...] get things started here&#8217;s a live demo of the digg style paging in asp.net project I created.       &nbsp;    del.icio.us [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 9.406 seconds -->
