<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Custom ASP.NET Data Pager Control</title>
	<link>http://www.flixon.com/2008/04/28/custom-aspnet-data-pager-control/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Thu, 20 Nov 2008 21:43:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: admin</title>
		<link>http://www.flixon.com/2008/04/28/custom-aspnet-data-pager-control/#comment-195</link>
		<author>admin</author>
		<pubDate>Mon, 28 Apr 2008 17:43:16 +0000</pubDate>
		<guid>http://www.flixon.com/2008/04/28/custom-aspnet-data-pager-control/#comment-195</guid>
		<description>Here's a slight modification which allows you to place the Pager within the TemplatePagerField of the DataPager (if you are using a data source control).  This allows you to keep your ui consistent and easier to update.

Add the following to the bottom of the HandleEvent method:

if (string.IsNullOrEmpty(this.QueryStringField))
{
    DataPager dataPager = this.Parent.Parent as DataPager;

    if (dataPager != null)
        dataPager.SetPageProperties(this.StartRowIndex, this.PageSize, true);
}

You could optionally call the SetPageProperties method within your own event handler you can wire up against the Pager but this seemed like too much hard work for me.

If you are using the query string approach you will notice the same problem without the above fix.  After abit of fiddling around i finally come up with abit of a hack.  Simply add the following inside the fields part of the DataPager:

&lt;asp:NextPreviousPagerField ShowFirstPageButton="false" ShowLastPageButton="false" ShowNextPageButton="false" ShowPreviousPageButton="false" /&gt;</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a slight modification which allows you to place the Pager within the TemplatePagerField of the DataPager (if you are using a data source control).  This allows you to keep your ui consistent and easier to update.</p>
<p>Add the following to the bottom of the HandleEvent method:</p>
<p>if (string.IsNullOrEmpty(this.QueryStringField))<br />
{<br />
    DataPager dataPager = this.Parent.Parent as DataPager;</p>
<p>    if (dataPager != null)<br />
        dataPager.SetPageProperties(this.StartRowIndex, this.PageSize, true);<br />
}</p>
<p>You could optionally call the SetPageProperties method within your own event handler you can wire up against the Pager but this seemed like too much hard work for me.</p>
<p>If you are using the query string approach you will notice the same problem without the above fix.  After abit of fiddling around i finally come up with abit of a hack.  Simply add the following inside the fields part of the DataPager:</p>
<p><asp :NextPreviousPagerField ShowFirstPageButton="false" ShowLastPageButton="false" ShowNextPageButton="false" ShowPreviousPageButton="false" /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
