<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Raihan Iqbal</title>
	<atom:link href="http://www.raihaniqbal.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.raihaniqbal.org/blog</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 06 Jan 2009 04:21:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Resizing Images In ASP.NET</title>
		<link>http://www.raihaniqbal.org/blog/resizing-images-in-aspnet/</link>
		<comments>http://www.raihaniqbal.org/blog/resizing-images-in-aspnet/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 04:21:57 +0000</pubDate>
		<dc:creator>Raihan Iqbal</dc:creator>
		
		<category><![CDATA[.net]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.raihaniqbal.org/blog/resizing-images-in-aspnet/</guid>
		<description><![CDATA[I&#8217;m sure there are plenty of similar topics out there but this is my two cents. Lets say you have the following code in your ASP.NET page:

&#160;&#160;&#160; 1 Upload a File: &#38;nbsp;&#60;asp:FileUpload ID=&#34;pictureUpload&#34; runat=&#34;server&#34; /&#62;&#60;br /&#62;
&#160;&#160;&#160; 2&#160;&#60;asp:Button ID=&#34;btnUpload&#34; runat=&#34;server&#34; Text=&#34;Upload&#34; OnCommand=&#34;handle_ButtonClick&#34; CommandName=&#34;Upload&#34; /&#62;

Let&#8217;s look at the event handler code that uploads the image to the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure there are plenty of similar topics out there but this is my two cents. Lets say you have the following code in your ASP.NET page:</p>
<div style="font-size: 10pt; background: #2e2e2e; overflow: auto; width: 99.45%; color: #d2d200; font-family: consolas; height: 45px">
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 1</span> Upload a File: <span style="color: #cfbfaf">&amp;nbsp;</span><span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">asp</span><span style="color: #efef8f">:</span><span style="color: #e3ceab">FileUpload</span> <span style="color: #dfdfbf">ID</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;pictureUpload&quot;</span> <span style="color: #dfdfbf">runat</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;server&quot;</span> <span style="color: #efef8f">/&gt;&lt;</span><span style="color: #e3ceab">br</span> <span style="color: #efef8f">/&gt;</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 2</span>&#160;<span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">asp</span><span style="color: #efef8f">:</span><span style="color: #e3ceab">Button</span> <span style="color: #dfdfbf">ID</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;btnUpload&quot;</span> <span style="color: #dfdfbf">runat</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;server&quot;</span> <span style="color: #dfdfbf">Text</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;Upload&quot;</span> <span style="color: #dfdfbf">OnCommand</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;handle_ButtonClick&quot;</span> <span style="color: #dfdfbf">CommandName</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;Upload&quot;</span> <span style="color: #efef8f">/&gt;</span></p>
</p></div>
<p>Let&#8217;s look at the event handler code that uploads the image to the server and resizes it.</p>
<div style="font-size: 10pt; background: #2e2e2e; overflow: auto; width: 99.74%; color: #d2d200; font-family: consolas; height: 570px">
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 1</span>&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">protected</span> <span style="font-weight: bold; color: #eaeaac">void</span> <span style="color: #f8ffc6">handle_ButtonClick</span>(<span style="font-weight: bold; color: #eaeaac">object</span> <span style="color: #f8ffc6">sender</span>, <span style="color: #f0dfaf">CommandEventArgs</span> <span style="color: #f8ffc6">e</span>)</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 2</span>&#160;&#160;&#160;&#160; {</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 3</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">if</span> (<span style="color: #f8ffc6">e</span>.<span style="color: #f8ffc6">CommandName</span> == <span style="color: #c89191">&quot;Upload&quot;</span>)</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 4</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 5</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">if</span> (<span style="color: #f8ffc6">pictureUpload</span>.<span style="color: #f8ffc6">HasFile</span>)</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 6</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 7</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">string</span> <span style="color: #f8ffc6">FilePath</span> = <span style="color: #f0dfaf">HttpContext</span>.<span style="color: #f8ffc6">Current</span>.<span style="color: #f8ffc6">Server</span>.<span style="color: #f8ffc6">MapPath</span>(<span style="color: #f8ffc6">PATH_FILESFOLDER</span>) + <span style="color: #f8ffc6">pictureUpload</span>.<span style="color: #f8ffc6">FileName</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 8</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">pictureUpload</span>.<span style="color: #f8ffc6">SaveAs</span>(<span style="color: #f8ffc6">FilePath</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 9</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">ResizeImageAndSave</span>(<span style="color: #f8ffc6">FilePath</span>, <span style="color: #8acccf">90</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 10</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 11</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 12</span>&#160;&#160;&#160;&#160; }</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 13</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 14</span>&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">public</span> <span style="font-weight: bold; color: #eaeaac">void</span> <span style="color: #f8ffc6">ResizeImageAndSave</span>(<span style="font-weight: bold; color: #eaeaac">string</span> <span style="color: #f8ffc6">FilePath</span>, <span style="font-weight: bold; color: #eaeaac">int</span> <span style="color: #f8ffc6">Width</span>)</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 15</span>&#160;&#160;&#160;&#160; {</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 16</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Bitmap</span> <span style="color: #f8ffc6">loBMP</span> = <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f8ffc6">Bitmap</span>(<span style="color: #f8ffc6">FilePath</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 17</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">ImageFormat</span> <span style="color: #f8ffc6">loFormat</span> = <span style="color: #f8ffc6">loBMP</span>.<span style="color: #f8ffc6">RawFormat</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 18</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 19</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: lime">//*** If the image is smaller than a thumbnail just return it</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 20</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">if</span> (<span style="color: #f8ffc6">loBMP</span>.<span style="color: #f8ffc6">Width</span> &lt; <span style="color: #f8ffc6">Width</span>) <span style="font-weight: bold; color: #eaeaac">return</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 21</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 22</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">decimal</span> <span style="color: #f8ffc6">lnRatio</span> = <span style="color: #f0dfaf">Convert</span>.<span style="color: #f8ffc6">ToDecimal</span>(<span style="color: #f8ffc6">Width</span>) / <span style="color: #f8ffc6">loBMP</span>.<span style="color: #f8ffc6">Width</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 23</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">int</span> <span style="color: #f8ffc6">lnNewWidth</span> = <span style="color: #f8ffc6">Width</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 24</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">int</span> <span style="color: #f8ffc6">lnNewHeight</span> = <span style="color: #f0dfaf">Convert</span>.<span style="color: #f8ffc6">ToInt32</span>(<span style="color: #f8ffc6">loBMP</span>.<span style="color: #f8ffc6">Height</span> * <span style="color: #f8ffc6">lnRatio</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 25</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 26</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Bitmap</span> <span style="color: #f8ffc6">bmpOut</span> = <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f8ffc6">Bitmap</span>(<span style="color: #f8ffc6">lnNewWidth</span>, <span style="color: #f8ffc6">lnNewHeight</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 27</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Graphics</span> <span style="color: #f8ffc6">g</span> = <span style="color: #f8ffc6">Graphics</span>.<span style="color: #f8ffc6">FromImage</span>(<span style="color: #f8ffc6">bmpOut</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 28</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">g</span>.<span style="color: #f8ffc6">InterpolationMode</span> = <span style="color: #f8ffc6">System</span>.<span style="color: #f8ffc6">Drawing</span>.<span style="color: #f8ffc6">Drawing2D</span>.<span style="color: #2b91af">InterpolationMode</span>.<span style="color: #f8ffc6">HighQualityBicubic</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 29</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">g</span>.<span style="color: #f8ffc6">FillRectangle</span>(<span style="color: #f8ffc6">Brushes</span>.<span style="color: #f8ffc6">White</span>, <span style="color: #8acccf">0</span>, <span style="color: #8acccf">0</span>, <span style="color: #f8ffc6">lnNewWidth</span>, <span style="color: #f8ffc6">lnNewHeight</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 30</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">g</span>.<span style="color: #f8ffc6">DrawImage</span>(<span style="color: #f8ffc6">loBMP</span>, <span style="color: #8acccf">0</span>, <span style="color: #8acccf">0</span>, <span style="color: #f8ffc6">lnNewWidth</span>, <span style="color: #f8ffc6">lnNewHeight</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 31</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 32</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: lime">//Dispose old&#160; BMP object</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 33</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">loBMP</span>.<span style="color: #f8ffc6">Dispose</span>();</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 34</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 35</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">bmpOut</span>.<span style="color: #f8ffc6">Save</span>(<span style="color: #f8ffc6">FilePath</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 36</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">bmpOut</span>.<span style="color: #f8ffc6">Dispose</span>();</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 37</span>&#160;&#160;&#160;&#160; }</p>
</p></div>
<p>The code is pretty obvious - save the file to the specified path, resize the image, dispose the old image and finally save the new image.</p>
<p>Happy Programming!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raihaniqbal.org/blog/resizing-images-in-aspnet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simulate network delay</title>
		<link>http://www.raihaniqbal.org/blog/simulate-network-delay/</link>
		<comments>http://www.raihaniqbal.org/blog/simulate-network-delay/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 08:00:38 +0000</pubDate>
		<dc:creator>Raihan Iqbal</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.raihaniqbal.org/blog/simulate-network-delay/</guid>
		<description><![CDATA[Sometimes developers need to simulate network delay during development and testing for various reasons. Sloppy is a tool that does just that. You will need the latest java runtime installed for it to work. Just go the link above and follow the instructions.

]]></description>
			<content:encoded><![CDATA[<p>Sometimes developers need to simulate network delay during development and testing for various reasons. Sloppy is a tool that does just that. You will need the latest java runtime installed for it to work. Just go the link above and follow the instructions.</p>
<p><a href="http://www.raihaniqbal.org/blog/wp-content/uploads/2008/12/sshot-1.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="418" alt="sshot-1" src="http://www.raihaniqbal.org/blog/wp-content/uploads/2008/12/sshot-1-thumb.jpg" width="468" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.raihaniqbal.org/blog/simulate-network-delay/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ASP.NET ImageButton not supported in Firefox 2.0</title>
		<link>http://www.raihaniqbal.org/blog/aspnet-imagebutton-not-supported-in-firefox-20/</link>
		<comments>http://www.raihaniqbal.org/blog/aspnet-imagebutton-not-supported-in-firefox-20/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 13:43:22 +0000</pubDate>
		<dc:creator>Raihan Iqbal</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.raihaniqbal.org/blog/aspnet-imagebutton-not-supported-in-firefox-20/</guid>
		<description><![CDATA[I recently discovered that the ImageButton and LinkButton ASP.NET controls do not function properly in Firefox 2.0. I wasted almost two days trying to figure out what was wrong with my code. Apparently, I was chasing a ghost! For more information on this problem can be found here. Unfortunately, the only workaround for this problem [...]]]></description>
			<content:encoded><![CDATA[<p>I recently discovered that the ImageButton and LinkButton ASP.NET controls do not function properly in Firefox 2.0. I wasted almost two days trying to figure out what was wrong with my code. Apparently, I was chasing a ghost! For more information on this problem can be found <a href="http://support.microsoft.com/kb/921277" target="_blank">here</a>. Unfortunately, the only workaround for this problem is to either upgrade to Firefox 3, which ROCKS by the way, or use a standard ASP.NET button and style it using CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raihaniqbal.org/blog/aspnet-imagebutton-not-supported-in-firefox-20/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using FlexiGrid in your ASP.NET application</title>
		<link>http://www.raihaniqbal.org/blog/using-flexigrid-in-your-aspnet-application/</link>
		<comments>http://www.raihaniqbal.org/blog/using-flexigrid-in-your-aspnet-application/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 17:30:58 +0000</pubDate>
		<dc:creator>Raihan Iqbal</dc:creator>
		
		<category><![CDATA[.net]]></category>

		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.raihaniqbal.org/blog/using-flexigrid-in-your-aspnet-application/</guid>
		<description><![CDATA[I&#8217;ve been exploring JQuery for quiet some time now and I&#8217;m already a huge fan! Not only is it light-weight but its extensible too - there are plugins for everything, just name it! Well, almost everything  Today I&#8217;m going to demonstrate how we can use the excellent FlexiGrid plugin in our ASP.NET applications.
Add the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been exploring <a href="http://www.jquery.com" target="_blank">JQuery</a> for quiet some time now and I&#8217;m already a huge fan! Not only is it light-weight but its extensible too - there are plugins for everything, just name it! Well, almost everything <img src='http://www.raihaniqbal.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Today I&#8217;m going to demonstrate how we can use the excellent FlexiGrid plugin in our ASP.NET applications.</p>
<p>Add the following code to the head section of the document in which you want to display the grid.</p>
<div style="font-family: Consolas; font-size: 8pt; color: #d2d200; background: #2e2e2e; overflow: visible; line-height: 12pt; padding: 0"><span style="color: #85ac8d">&#160;&#160;&#160; 1</span>&#160;<span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">link</span> <span style="color: #dfdfbf">href</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;style/flexigrid.css&quot;</span> <span style="color: #dfdfbf">rel</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;stylesheet&quot;</span> <span style="color: #dfdfbf">type</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;text/css&quot;</span> <span style="color: #efef8f">/&gt;</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 2</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 3</span>&#160;&#160;&#160;&#160; <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">script</span> <span style="color: #dfdfbf">src</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;scripts/jquery.js&quot;</span> <span style="color: #dfdfbf">type</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;text/javascript&quot;</span><span style="color: #efef8f">&gt;&lt;/</span><span style="color: #e3ceab">script</span><span style="color: #efef8f">&gt;</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 4</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 5</span>&#160;&#160;&#160;&#160; <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">script</span> <span style="color: #dfdfbf">src</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;scripts/jquery.flexigrid.js&quot;</span> <span style="color: #dfdfbf">type</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;text/javascript&quot;</span><span style="color: #efef8f">&gt;&lt;/</span><span style="color: #e3ceab">script</span><span style="color: #efef8f">&gt;</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 6</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 7</span>&#160;&#160;&#160;&#160; <span style="color: #efef8f">&lt;</span><span style="color: #e3ceab">script</span> <span style="color: #dfdfbf">type</span><span style="color: #efef8f">=</span><span style="color: #cc9393">&quot;text/javascript&quot;</span><span style="color: #efef8f">&gt;</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 8</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 9</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">$</span>(<span style="color: #f8ffc6">document</span>).<span style="color: #f8ffc6">ready</span>(<span style="font-weight: bold; color: #eaeaac">function</span>(){</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 10</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 11</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">$</span>(<span style="color: #c89191">&quot;#flex1&quot;</span>).<span style="color: #f8ffc6">flexigrid</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 12</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 13</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 14</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">url</span>: <span style="color: #c89191">&#8216;GetData.aspx&#8217;</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 15</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">dataType</span>: <span style="color: #c89191">&#8216;xml&#8217;</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 16</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">colModel</span> : [</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 17</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<span style="color: #f8ffc6">display</span>: <span style="color: #c89191">'ISO'</span>, <span style="color: #f8ffc6">name</span> : <span style="color: #c89191">'iso'</span>, <span style="color: #f8ffc6">width</span> : <span style="color: #8acccf">40</span>, <span style="color: #f8ffc6">sortable</span> : <span style="font-weight: bold; color: #eaeaac">true</span>, <span style="color: #f8ffc6">align</span>: <span style="color: #c89191">'center'</span>},</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 18</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<span style="color: #f8ffc6">display</span>: <span style="color: #c89191">'Name'</span>, <span style="color: #f8ffc6">name</span> : <span style="color: #c89191">'name'</span>, <span style="color: #f8ffc6">width</span> : <span style="color: #8acccf">180</span>, <span style="color: #f8ffc6">sortable</span> : <span style="font-weight: bold; color: #eaeaac">true</span>, <span style="color: #f8ffc6">align</span>: <span style="color: #c89191">'left'</span>},</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 19</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<span style="color: #f8ffc6">display</span>: <span style="color: #c89191">'Printable Name'</span>, <span style="color: #f8ffc6">name</span> : <span style="color: #c89191">'printable_name'</span>, <span style="color: #f8ffc6">width</span> : <span style="color: #8acccf">120</span>, <span style="color: #f8ffc6">sortable</span> : <span style="font-weight: bold; color: #eaeaac">true</span>, <span style="color: #f8ffc6">align</span>: <span style="color: #c89191">'left'</span>},</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 20</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<span style="color: #f8ffc6">display</span>: <span style="color: #c89191">'ISO3'</span>, <span style="color: #f8ffc6">name</span> : <span style="color: #c89191">'iso3'</span>, <span style="color: #f8ffc6">width</span> : <span style="color: #8acccf">130</span>, <span style="color: #f8ffc6">sortable</span> : <span style="font-weight: bold; color: #eaeaac">true</span>, <span style="color: #f8ffc6">align</span>: <span style="color: #c89191">'left'</span>},</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 21</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<span style="color: #f8ffc6">display</span>: <span style="color: #c89191">'Number Code'</span>, <span style="color: #f8ffc6">name</span> : <span style="color: #c89191">'numcode'</span>, <span style="color: #f8ffc6">width</span> : <span style="color: #8acccf">80</span>, <span style="color: #f8ffc6">sortable</span> : <span style="font-weight: bold; color: #eaeaac">true</span>, <span style="color: #f8ffc6">align</span>: <span style="color: #c89191">'right'</span>}</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 22</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 23</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 24</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: lime">/*searchitems : [</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 25</span>&#160;<span style="color: lime">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {display: 'ISO', name : 'iso'},</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 26</span>&#160;<span style="color: lime">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {display: 'Name', name : 'name', isdefault: true}</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 27</span>&#160;<span style="color: lime">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],*/</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 28</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">sortname</span>: <span style="color: #c89191">&quot;iso&quot;</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 29</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">sortorder</span>: <span style="color: #c89191">&quot;asc&quot;</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 30</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">usepager</span>: <span style="font-weight: bold; color: #eaeaac">true</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 31</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">title</span>: <span style="color: #c89191">&#8216;Countries&#8217;</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 32</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">useRp</span>: <span style="font-weight: bold; color: #eaeaac">true</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 33</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">rp</span>: <span style="color: #8acccf">15</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 34</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">showTableToggleBtn</span>: <span style="font-weight: bold; color: #eaeaac">true</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 35</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">width</span>: <span style="color: #8acccf">700</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 36</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">height</span>: <span style="color: #8acccf">400</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 37</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 38</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 39</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 40</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 41</span>&#160;&#160;&#160;&#160; <span style="color: #efef8f">&lt;/</span><span style="color: #e3ceab">script</span><span style="color: #efef8f">&gt;</span></p>
</p></div>
<p>The grid is going to get its data from an aspx file called &quot;GetData.aspx&quot;. In the Page_Load(..) event of this page, generate the XML and send it back to the requesting page.</p>
<div style="font-family: Consolas; font-size: 8pt; color: #d2d200; background: #2e2e2e; overflow: visible; line-height: 12pt; padding: 0">
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 1</span>&#160;<span style="font-weight: bold; color: #eaeaac">int</span> <span style="color: #f8ffc6">page</span> = <span style="font-weight: bold; color: #eaeaac">int</span>.<span style="color: #f8ffc6">Parse</span>( <span style="color: #f8ffc6">Request</span>.<span style="color: #f8ffc6">Form</span>[ <span style="color: #c89191">&quot;page&quot;</span> ].<span style="color: #f8ffc6">ToString</span>() );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 2</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">int</span> <span style="color: #f8ffc6">rp</span> = <span style="font-weight: bold; color: #eaeaac">int</span>.<span style="color: #f8ffc6">Parse</span>( <span style="color: #f8ffc6">Request</span>.<span style="color: #f8ffc6">Form</span>[ <span style="color: #c89191">&quot;rp&quot;</span> ].<span style="color: #f8ffc6">ToString</span>() );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 3</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">string</span> <span style="color: #f8ffc6">sortname</span> = <span style="color: #f8ffc6">Request</span>.<span style="color: #f8ffc6">Form</span>[ <span style="color: #c89191">&quot;sortname&quot;</span> ].<span style="color: #f8ffc6">ToString</span>();</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 4</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">string</span> <span style="color: #f8ffc6">sortorder</span> = <span style="color: #f8ffc6">Request</span>.<span style="color: #f8ffc6">Form</span>[ <span style="color: #c89191">&quot;sortorder&quot;</span> ].<span style="color: #f8ffc6">ToString</span>();</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 5</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 6</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">string</span> <span style="color: #f8ffc6">sort</span> = <span style="color: #f0dfaf">String</span>.<span style="color: #f8ffc6">Format</span>( <span style="color: #c89191">&quot;ORDER BY {0} {1}&quot;</span>, <span style="color: #f8ffc6">sortname</span>, <span style="color: #f8ffc6">sortorder</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 7</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 8</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">if</span>( <span style="color: #f8ffc6">page</span> == <span style="font-weight: bold; color: #eaeaac">null</span> )</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160;&#160; 9</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">page</span> = <span style="color: #8acccf">1</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 10</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 11</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">if</span>( <span style="color: #f8ffc6">rp</span> == <span style="font-weight: bold; color: #eaeaac">null</span> )</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 12</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">rp</span> = <span style="color: #8acccf">10</span>;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 13</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 14</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">int</span> <span style="color: #f8ffc6">start</span> = ( ( <span style="color: #f8ffc6">page</span> - <span style="color: #8acccf">1</span> ) * <span style="color: #f8ffc6">rp</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 15</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 16</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">string</span> <span style="color: #f8ffc6">limit</span> = <span style="color: #f0dfaf">String</span>.<span style="color: #f8ffc6">Format</span>( <span style="color: #c89191">&quot;LIMIT {0}, {1}&quot;</span>, <span style="color: #f8ffc6">start</span>, <span style="color: #f8ffc6">rp</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 17</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 18</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">ClearHeaders</span>();</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 19</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">AppendHeader</span>( <span style="color: #c89191">&quot;Expires&quot;</span>, <span style="color: #c89191">&quot;Mon, 26 Jul 1997 05:00:00 GMT&quot;</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 20</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">AppendHeader</span>( <span style="color: #c89191">&quot;Last-Modified&quot;</span>, <span style="color: #2b91af">DateTime</span>.<span style="color: #f8ffc6">Now</span>.<span style="color: #f8ffc6">ToLongDateString</span>() + <span style="color: #c89191">&quot; &quot;</span> + <span style="color: #2b91af">DateTime</span>.<span style="color: #f8ffc6">Now</span>.<span style="color: #f8ffc6">ToLongTimeString</span>() );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 21</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">AppendHeader</span>( <span style="color: #c89191">&quot;Cache-Control&quot;</span>, <span style="color: #c89191">&quot;no-cache, must-revalidate&quot;</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 22</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">AppendHeader</span>( <span style="color: #c89191">&quot;Pragma&quot;</span>, <span style="color: #c89191">&quot;no-cache&quot;</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 23</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">AppendHeader</span>( <span style="color: #c89191">&quot;Content-type&quot;</span>, <span style="color: #c89191">&quot;text/xml&quot;</span> );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 24</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 25</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 26</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: lime">// Generating XML Data</span></p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 27</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 28</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f0dfaf">EnumerableRowCollection</span>&lt;<span style="color: #f0dfaf">DataRow</span>&gt; <span style="color: #f8ffc6">data</span> = <span style="color: #f8ffc6">GetCountryDataTable</span>(<span style="color: #f8ffc6">sort</span>, <span style="color: #f8ffc6">limit</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 29</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 30</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f0dfaf">XDocument</span> <span style="color: #f8ffc6">xmlDoc</span> = <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XDocument</span>(</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 31</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XDeclaration</span>(<span style="color: #c89191">&quot;1.0&quot;</span>, <span style="color: #c89191">&quot;utf-8&quot;</span>, <span style="color: #c89191">&quot;yes&quot;</span>),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 32</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 33</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;rows&quot;</span>,</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 34</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;page&quot;</span>, <span style="color: #f8ffc6">page</span>.<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 35</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;total&quot;</span>, <span style="color: #f8ffc6">GetTotalRecords</span>().<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 36</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">data</span>.<span style="color: #f8ffc6">Select</span>(<span style="color: #f8ffc6">row</span> =&gt; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;row&quot;</span>, <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XAttribute</span>(<span style="color: #c89191">&quot;id&quot;</span>, <span style="color: #f8ffc6">row</span>[<span style="color: #c89191">&quot;iso&quot;</span>].<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 37</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;cell&quot;</span>, <span style="color: #f8ffc6">row</span>[<span style="color: #c89191">&quot;iso&quot;</span>].<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 38</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;cell&quot;</span>, <span style="color: #f8ffc6">row</span>[<span style="color: #c89191">&quot;name&quot;</span>].<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 39</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;cell&quot;</span>, <span style="color: #f8ffc6">row</span>[<span style="color: #c89191">&quot;printable_name&quot;</span>].<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 40</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;cell&quot;</span>, <span style="color: #f8ffc6">row</span>[<span style="color: #c89191">&quot;iso3&quot;</span>].<span style="color: #f8ffc6">ToString</span>()),</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 41</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="font-weight: bold; color: #eaeaac">new</span> <span style="color: #f0dfaf">XElement</span>(<span style="color: #c89191">&quot;cell&quot;</span>, <span style="color: #f8ffc6">row</span>[<span style="color: #c89191">&quot;numcode&quot;</span>].<span style="color: #f8ffc6">ToString</span>())</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 42</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; )</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 43</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; )</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 44</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; )</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 45</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 46</span>&#160;</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 47</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">Write</span>(<span style="color: #f8ffc6">xmlDoc</span>);</p>
<p style="margin: 0px"><span style="color: #85ac8d">&#160;&#160; 48</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #f8ffc6">Response</span>.<span style="color: #f8ffc6">End</span>();</p>
</p></div>
<p>Here&#8217;s the function that returns the DataRow collection.</p>
<div style="font-family: Consolas; font-size: 8pt; color: #d2d200; background: #2e2e2e; overflow: visible; line-height: 12pt; padding: 0">
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;1</span>&nbsp;<span style="color: #eaeaac; font-weight: bold;">private</span> <span style="color: #f0dfaf;">EnumerableRowCollection</span>&lt;<span style="color: #f0dfaf;">DataRow</span>&gt; <span style="color: #f8ffc6;">GetCountryDataTable</span>( <span style="color: #eaeaac; font-weight: bold;">string</span> <span style="color: #f8ffc6;">sort</span>, <span style="color: #eaeaac; font-weight: bold;">string</span> <span style="color: #f8ffc6;">limit</span> )</p>
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;2</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p>
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;3</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #eaeaac; font-weight: bold;">using</span>( <span style="color: #f0dfaf;">DBM</span>.<span style="color: #f0dfaf;">SqlCommandEx</span> <span style="color: #f8ffc6;">sqlCmd</span> = <span style="color: #eaeaac; font-weight: bold;">new</span> <span style="color: #f0dfaf;">DBM</span>.<span style="color: #f0dfaf;">SqlCommandEx</span>( <span style="color: #f0dfaf;">String</span>.<span style="color: #f8ffc6;">Format</span>( <span style="color: #c89191;">&#8220;SELECT iso,name,printable_name,iso3,numcode FROM country {0} {1}&#8221;</span>, <span style="color: #f8ffc6;">sort</span>, <span style="color: #f8ffc6;">limit</span> ) ) )</p>
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;4</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p>
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;5</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #eaeaac; font-weight: bold;">return</span> <span style="color: #f8ffc6;">sqlCmd</span>.<span style="color: #f8ffc6;">GetDataTable</span>().<span style="color: #f8ffc6;">AsEnumerable</span>();</p>
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;6</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p style="margin: 0px;"><span style="color: #85ac8d;">&nbsp;&nbsp;&nbsp;&nbsp;7</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
</div>
<p>Finally, I used LINQ to create the XML document but you can do it using Strings or any other method you prefer.&#160; </p>
<p>Happy Programming!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raihaniqbal.org/blog/using-flexigrid-in-your-aspnet-application/feed/</wfw:commentRss>
		</item>
		<item>
		<title>HOW TO: Display RSS Feeds in your PRADO app</title>
		<link>http://www.raihaniqbal.org/blog/how-to-display-rss-feeds-in-your-prado-app/</link>
		<comments>http://www.raihaniqbal.org/blog/how-to-display-rss-feeds-in-your-prado-app/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 17:33:36 +0000</pubDate>
		<dc:creator>Raihan Iqbal</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[PRADO]]></category>

		<guid isPermaLink="false">http://www.raihaniqbal.org/blog/?p=3</guid>
		<description><![CDATA[This guide will show you how to easily parse and display RSS Feeds in your php application no matter what framework you use. However, I will be using the PRADO framework for this demonstration. The Parser Since I&#8217;m a big fan of open-source software, I used MagpieRSS. MagpieRSS provides an XML-based (expat) RSS parser in [...]]]></description>
			<content:encoded><![CDATA[<p>This guide will show you how to easily parse and display RSS Feeds in your php application no matter what framework you use. However, I will be using the PRADO framework for this demonstration. The Parser Since I&#8217;m a big fan of open-source software, I used <a href="http://http://magpierss.sourceforge.net/" target="_blank">MagpieRSS</a>. MagpieRSS provides an XML-based (expat) RSS parser in PHP. The toolkit can be very easily integrated to your PHP application with just one line of code. Follow these steps to install the toolkit into your prado application:</p>
<ol>
<li>Download the toolkit from <a href="http://sourceforge.net/project/showfiles.php?group_id=55691" target="_blank">here</a>.</li>
<li>Create a folder within the <strong>protected</strong> folder of your application. You can name it anything you like. I&#8217;ll name it <strong>Common</strong>. Now your applications directory structure should look something like this</li>
<p style="text-align: center;"><img class="aligncenter" title="pradorss1" src="http://www.raihaniqbal.org/blog/wp-content/uploads/2008/06/pradorss1.jpg" alt="" /></p>
<li>Extract the contents of the package that you downloaded in the previous step into the Common folder.</li>
<li>Now you will see a file named <strong>rss_fetch.inc</strong>. Rename that file to <strong>rss_fetch.php</strong>. I’ll explain why I did this in the next step.</li>
<li>Include the rss_fetch.php file in your prado class and call the parser within a function as follows</li>
<p style="text-align: center;"><img class="aligncenter" title="Prado Code" src="http://www.raihaniqbal.org/blog/wp-content/uploads/2008/06/sshot-1.png" alt="Prado Directory Structure" /></p>
</ol>
<p>If we don’t rename rss_fetch.inc to rss_fetch.php in the previous step we cannot use the prado style include statement as shown in Line 1; Instead we have to use include_once(..). I did that just to maintain consistency in my coding style - no biggie <img src='http://www.raihaniqbal.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.raihaniqbal.org/blog/how-to-display-rss-feeds-in-your-prado-app/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
