<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Joe Stevens&#039; Blog &#187; C#</title>
	<atom:link href="http://www.joe-stevens.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joe-stevens.com</link>
	<description>Everything .NET and C#</description>
	<lastBuildDate>Sat, 24 Jul 2010 00:23:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to get the time difference between two DateTimes using C#</title>
		<link>http://www.joe-stevens.com/2010/06/25/how-to-get-the-time-difference-between-two-datetimes-using-c/</link>
		<comments>http://www.joe-stevens.com/2010/06/25/how-to-get-the-time-difference-between-two-datetimes-using-c/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 03:57:43 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[TimeSpan]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=491</guid>
		<description><![CDATA[Here&#8217;s a quick an easy way to show the time difference between two DateTime objects using C#.
The DateTime structure has an overridden subtract operator which return a TimeSpan object when subtracting two DateTimes:

public static TimeSpan operator -(DateTime d1, DateTime d2);

You can then use this TimeSpan to get the amount of time between each DateTime:


DateTime fromDate [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2010/06/25/how-to-get-the-time-difference-between-two-datetimes-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert a comma separated string of numbers to an integer array using C#</title>
		<link>http://www.joe-stevens.com/2010/06/10/convert-a-comma-separated-string-of-numbers-to-an-integer-array-using-c/</link>
		<comments>http://www.joe-stevens.com/2010/06/10/convert-a-comma-separated-string-of-numbers-to-an-integer-array-using-c/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 05:51:35 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[CSV]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=487</guid>
		<description><![CDATA[Today I needed to convert a comma separated string of numbers in an integer array. Here is how you can do it in one line using Linq:

string csv = &#34;1,1,2,3,5,8,13,21,34&#34;;
int[] numbers = csv.Split(',').Select(n =&#62; int.Parse(n)).ToArray();

    ]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2010/06/10/convert-a-comma-separated-string-of-numbers-to-an-integer-array-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Composite Server Control with ASP.NET</title>
		<link>http://www.joe-stevens.com/2010/04/16/creating-a-composite-server-control-with-asp-net/</link>
		<comments>http://www.joe-stevens.com/2010/04/16/creating-a-composite-server-control-with-asp-net/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 05:31:22 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Composte Control]]></category>
		<category><![CDATA[Custom Control]]></category>
		<category><![CDATA[Server Control]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=465</guid>
		<description><![CDATA[Download source
When creating web applications with ASP.NET developers will usually create User Controls or Custom Server Controls. User Controls have the ASCX extension and allow developers to group together ASP.NET controls and functionality into a reusable control. Custom Controls are a bit more complex and require the developer to define the html that the control [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2010/04/16/creating-a-composite-server-control-with-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linq to XML Tutorial</title>
		<link>http://www.joe-stevens.com/2010/01/08/linq-to-xml-tutorial/</link>
		<comments>http://www.joe-stevens.com/2010/01/08/linq-to-xml-tutorial/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 02:42:09 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[linq to xml]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=377</guid>
		<description><![CDATA[Download source
This is an introduction to Linq to XML showing how to read, insert, update and delete from an XML file.

First of all lets look at the XML file I will be using:

&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;Customers&#62;
 &#60;Customer ID=&#34;1&#34;&#62;
  &#60;Forename&#62;Joe&#60;/Forename&#62;
  &#60;Surname&#62;Stevens&#60;/Surname&#62;
  &#60;DOB&#62;31/01/1983&#60;/DOB&#62;
  &#60;Location&#62;Sydney&#60;/Location&#62;
 &#60;/Customer&#62;
 &#60;Customer ID=&#34;2&#34;&#62;
  &#60;Forename&#62;Tom&#60;/Forename&#62;
  &#60;Surname&#62;Male&#60;/Surname&#62;
  &#60;DOB&#62;02/02/1977&#60;/DOB&#62;
  &#60;Location&#62;Brisbane&#60;/Location&#62;
 &#60;/Customer&#62;
 &#60;Customer ID=&#34;3&#34;&#62;
  &#60;Forename&#62;Emily &#60;/Forename&#62;
  &#60;Surname&#62;Stevens&#60;/Surname&#62;
  &#60;DOB&#62;14/01/1988&#60;/DOB&#62;
  &#60;Location&#62;Sydney&#60;/Location&#62;
 &#60;/Customer&#62;
 &#60;Customer ID=&#34;4&#34;&#62;
  &#60;Forename&#62;Lee&#60;/Forename&#62;
  &#60;Surname&#62;Phipps&#60;/Surname&#62;
  &#60;DOB&#62;05/12/1982&#60;/DOB&#62;
  &#60;Location&#62;Melbourne&#60;/Location&#62;
 &#60;/Customer&#62;
 &#60;Customer ID=&#34;5&#34;&#62;
  &#60;Forename&#62;Saul&#60;/Forename&#62;
  &#60;Surname&#62;Stevens&#60;/Surname&#62;
  &#60;DOB&#62;02/08/1984&#60;/DOB&#62;
  &#60;Location&#62;Perth&#60;/Location&#62;
 &#60;/Customer&#62;
&#60;/Customers&#62;

As you can see it&#8217;s a very simple list of customers.  In my project I [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2010/01/08/linq-to-xml-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using jQuery to make ajax calls to an ASMX web service using ASP.NET</title>
		<link>http://www.joe-stevens.com/2010/01/04/using-jquery-to-make-ajax-calls-to-an-asmx-web-service-using-asp-net/</link>
		<comments>http://www.joe-stevens.com/2010/01/04/using-jquery-to-make-ajax-calls-to-an-asmx-web-service-using-asp-net/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 06:02:45 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=351</guid>
		<description><![CDATA[Download source
Making ajax calls to an ASP.NET web service using jQuery is too easy.  In this post I&#8217;ll explain how to do it!

Start by creating a new web project and adding a new ASMX web service:

Open the new web service and uncomment the following line to allow the web service to be called from script.

[System.Web.Script.Services.ScriptService]

The web [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2010/01/04/using-jquery-to-make-ajax-calls-to-an-asmx-web-service-using-asp-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JSON Serialization using the DataContractJsonSerializer and C#</title>
		<link>http://www.joe-stevens.com/2009/12/29/json-serialization-using-the-datacontractjsonserializer-and-c/</link>
		<comments>http://www.joe-stevens.com/2009/12/29/json-serialization-using-the-datacontractjsonserializer-and-c/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 05:25:05 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[deserialization]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[serialization]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=336</guid>
		<description><![CDATA[Download source code
Previously I&#8217;d done JSON serialization using the JavaScriptSerializer which is part of AJAX Extensions 1.0, but this is now obsolete.
.NET 3.5 introduced the DataContractJsonSerializer class.  The class sits in the System.Runtime.Serialization.Json namespace which is curiously hidden away in the System.ServiceModel.Web assembly.
The DataContractJsonSerializer can serialize a class that contains the Serializable attribute or any [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/12/29/json-serialization-using-the-datacontractjsonserializer-and-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escape curly braces when using String.Format or StringBuilder.AppendFormat</title>
		<link>http://www.joe-stevens.com/2009/12/29/escape-curly-braces-when-using-string-format-or-stringbuilder-appendformat/</link>
		<comments>http://www.joe-stevens.com/2009/12/29/escape-curly-braces-when-using-string-format-or-stringbuilder-appendformat/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 22:44:53 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[stringbuilder]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=330</guid>
		<description><![CDATA[I was using the StringBuilder to create a JSON string which included an array and therefore curly braces, but I got an exception as curly braces are used to define the parameters for the format.

sb.AppendFormat(&#34;{\&#34;Forename\&#34;:\&#34;{0}\&#34;,\&#34;Surname\&#34;:\&#34;{1}\&#34;}&#34;, person.Forename, person.Surname);

At first I tried adding a backslash which is used to escape the quotation mark but this didn&#8217;t work, so I tried the double [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/12/29/escape-curly-braces-when-using-string-format-or-stringbuilder-appendformat/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linq to SQL Tutorial &#8211; Linq to SQL Generic Framework using reflection</title>
		<link>http://www.joe-stevens.com/2009/12/28/linq-to-sql-generic-framework-using-reflection/</link>
		<comments>http://www.joe-stevens.com/2009/12/28/linq-to-sql-generic-framework-using-reflection/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 03:01:11 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[generic]]></category>
		<category><![CDATA[Linq To SQL]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/2009/12/28/linq-to-sql-generic-framework-using-reflection/</guid>
		<description><![CDATA[Download source code
In a previous post; Base Repository/Business Logic wrapper, I talked about a basic Linq to SQL Framework I created.  I then extended it in my ObjectDataSource binding with paging and sorting post to show how to use it with the ObjectDataSource.
The problem was that although it worked quite nicely for getting all [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/12/28/linq-to-sql-generic-framework-using-reflection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linq to SQL Tutorial &#8211; Using Load Options to preload data immediately without lazy loading</title>
		<link>http://www.joe-stevens.com/2009/11/23/linq-to-sql-using-load-options-to-preload-data-immediately-without-lazy-loading/</link>
		<comments>http://www.joe-stevens.com/2009/11/23/linq-to-sql-using-load-options-to-preload-data-immediately-without-lazy-loading/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 09:49:27 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[Linq To SQL]]></category>
		<category><![CDATA[load options]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=304</guid>
		<description><![CDATA[Download source
With Linq to SQL lazy loading is used by default. That means that if one object contains another object, the child object will only be loaded when first accessing it.  Using Load Options it is possible to tell Linq to SQL to also load the child object at the same time as loading [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/11/23/linq-to-sql-using-load-options-to-preload-data-immediately-without-lazy-loading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET FormView SetFocus</title>
		<link>http://www.joe-stevens.com/2009/11/20/asp-net-formview-setfocus/</link>
		<comments>http://www.joe-stevens.com/2009/11/20/asp-net-formview-setfocus/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 02:31:35 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[formview]]></category>
		<category><![CDATA[setfocus]]></category>
		<category><![CDATA[textbox]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=287</guid>
		<description><![CDATA[I have FormView and on changing to Edit mode I wanted to set focus to the first textbox. I thought I&#8217;d do this hooking into the ModeChanged event but this doesn&#8217;t work as the textbox hasn&#8217;t been rendered.
I then tried overriding the Render method and setting the focus after rendering; at this point the control [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/11/20/asp-net-formview-setfocus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read only Automatic Properties in C#</title>
		<link>http://www.joe-stevens.com/2009/11/17/read-only-automatic-properties-in-c/</link>
		<comments>http://www.joe-stevens.com/2009/11/17/read-only-automatic-properties-in-c/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 02:45:14 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[automatic properties]]></category>
		<category><![CDATA[automatic property]]></category>
		<category><![CDATA[read only]]></category>
		<category><![CDATA[readonly]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=285</guid>
		<description><![CDATA[Automatic Properties were a nice addition to C# 3 and I use them all the time. A lot of people may already know this but somehow I only found out this week; you can create a read only automatic property simply by adding the &#8216;private&#8217; keyword before &#8217;set&#8217;:


public class UserEventArgs : EventArgs
{
    public UserEventArgs(int userID)
    [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/11/17/read-only-automatic-properties-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Convert file size bytes to megabyte/gigabyte string using C#</title>
		<link>http://www.joe-stevens.com/2009/10/21/convert-file-size-bytes-to-megabytegigabyte-string-using-c/</link>
		<comments>http://www.joe-stevens.com/2009/10/21/convert-file-size-bytes-to-megabytegigabyte-string-using-c/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 04:32:27 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[bytes]]></category>
		<category><![CDATA[extension method]]></category>
		<category><![CDATA[file size]]></category>
		<category><![CDATA[gigabytes]]></category>
		<category><![CDATA[int32]]></category>
		<category><![CDATA[kilobytes]]></category>
		<category><![CDATA[megabytes]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=270</guid>
		<description><![CDATA[I feel like I haven&#8217;t posted in ages. Have been busy changing job and moving house but I have a list of things I want to blog about soon.
Recently I needed to convert a number of bytes to a readable string that represents the number of kilobytes, megabytes or gigabytes.
I created an extension method for [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/10/21/convert-file-size-bytes-to-megabytegigabyte-string-using-c/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Linq Tutorial &#8211; Using the Enumerable.Any extension method</title>
		<link>http://www.joe-stevens.com/2009/09/21/linq-using-the-enumerable-any-extension-method/</link>
		<comments>http://www.joe-stevens.com/2009/09/21/linq-using-the-enumerable-any-extension-method/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 00:18:21 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[all]]></category>
		<category><![CDATA[enumerable]]></category>
		<category><![CDATA[enumerable.all]]></category>
		<category><![CDATA[extension methods]]></category>
		<category><![CDATA[Linq To SQL]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=266</guid>
		<description><![CDATA[Consider the following:

Using Linq I want to select all the roles for a particular user.  I could create a query like this:


public List&#60;Role&#62; GetByUserID(int userID)
{
    List&#60;Role&#62; roles = (from r in Context.Roles
                    [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/21/linq-using-the-enumerable-any-extension-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linq to SQL &#8211; Using EntitySet.Remove to delete records</title>
		<link>http://www.joe-stevens.com/2009/09/18/linq-to-sql-using-entityset-remove-to-delete-records/</link>
		<comments>http://www.joe-stevens.com/2009/09/18/linq-to-sql-using-entityset-remove-to-delete-records/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 04:04:22 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[DeleteOnNull]]></category>
		<category><![CDATA[DMBL]]></category>
		<category><![CDATA[EntitySet]]></category>
		<category><![CDATA[EntitySet.Remove]]></category>
		<category><![CDATA[Linq To SQL]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=256</guid>
		<description><![CDATA[Download source
Quite often you have two tables with a linker table which causes Linq to SQL to generate an EntitySet of the related records in each table.
Take the following example:

Here, the User entity will have an EntitySet called UserRoles containing the Role entities that the user is part of.
When I want to remove a role from a user [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/18/linq-to-sql-using-entityset-remove-to-delete-records/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using FindControl for a control in the ItemTemplate of a ListView</title>
		<link>http://www.joe-stevens.com/2009/09/18/using-findcontrol-for-a-control-in-the-itemtemplate-of-a-listview/</link>
		<comments>http://www.joe-stevens.com/2009/09/18/using-findcontrol-for-a-control-in-the-itemtemplate-of-a-listview/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 01:09:21 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[findcontrol]]></category>
		<category><![CDATA[itemtemplate]]></category>
		<category><![CDATA[listview]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=252</guid>
		<description><![CDATA[I&#8217;ve been playing around with the ListView control recently and am quite impressed with it.  I like how it gives full control over the markup used as apposed to the other data driven controls.
I came across an issue where in my ItemTemplate I have a CheckBoxList which I needed to reference when I hit a button [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/18/using-findcontrol-for-a-control-in-the-itemtemplate-of-a-listview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Control.TryFindControl Extension Method</title>
		<link>http://www.joe-stevens.com/2009/09/15/control-tryfindcontrol-extension-method/</link>
		<comments>http://www.joe-stevens.com/2009/09/15/control-tryfindcontrol-extension-method/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 06:46:14 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[extension method]]></category>
		<category><![CDATA[TryFindControl]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=247</guid>
		<description><![CDATA[Following on from my last post creating an extension method to use FindControl recursively I thought it would be cool to also have a TryFindControl method which works in a similar way to Int32.TryParse which I use regularly.
Below is a generic extension method that uses my previously created recursive FindControl method to cast the object to [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/15/control-tryfindcontrol-extension-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursive FindControl Extension Method</title>
		<link>http://www.joe-stevens.com/2009/09/15/recursive-findcontrol-extension-method/</link>
		<comments>http://www.joe-stevens.com/2009/09/15/recursive-findcontrol-extension-method/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 06:20:17 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[extension method]]></category>
		<category><![CDATA[findcontrol]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=244</guid>
		<description><![CDATA[When working with templated controls it&#8217;s quite common to need a recursive FindControl method to navigate down through the control hierarchy to find the control you want.
Here is a simple extension method I wrote for Control to do this:


public static Control FindControl(this Control ctrl, string id, bool recursive)
{
    if (recursive)
    {
        foreach (Control child in [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/15/recursive-findcontrol-extension-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CheckBoxList ListBox SelectedItems Extension Method</title>
		<link>http://www.joe-stevens.com/2009/09/09/checkboxlist-listbox-selecteditems-extension-method/</link>
		<comments>http://www.joe-stevens.com/2009/09/09/checkboxlist-listbox-selecteditems-extension-method/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 05:13:27 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[checkboxlist]]></category>
		<category><![CDATA[extension method]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[selecteditems]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=237</guid>
		<description><![CDATA[I&#8217;ve been working with the CheckBoxList control and it&#8217;s annoying there is no property to get the selected items.
I wrote a simple extension method for ListControl, the abstract class that CheckBoxList and ListBox derive from, to get the selected items:


public static ListItemCollection GetSelectedItems(this ListControl source)
{
    ListItemCollection selectedItems = new ListItemCollection();

    foreach (ListItem item in source.Items)
    [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/09/checkboxlist-listbox-selecteditems-extension-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ObjectDataSource Exception Handling</title>
		<link>http://www.joe-stevens.com/2009/09/09/objectdatasource-exception-handling/</link>
		<comments>http://www.joe-stevens.com/2009/09/09/objectdatasource-exception-handling/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 03:50:36 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[ObjectDataSource]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=232</guid>
		<description><![CDATA[I was using the ObjectDataSource today to display and delete data using a GridView.  When I tried to delete a record that was referenced in another table an exception was thrown due to referential integrity.
I found that in implementing the Deleted event of the ObjectDataSource, the ObjectDataSourceStatusEventArgs class had a boolean property called ExceptionHandled.  Setting this to true [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/09/objectdatasource-exception-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET Property Parameter for Data Sources</title>
		<link>http://www.joe-stevens.com/2009/09/07/asp-net-property-parameter-for-data-sources/</link>
		<comments>http://www.joe-stevens.com/2009/09/07/asp-net-property-parameter-for-data-sources/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 03:44:05 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[datasource]]></category>
		<category><![CDATA[gridview]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[property]]></category>
		<category><![CDATA[propertyparameter]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=228</guid>
		<description><![CDATA[A few years ago I wrote a custom parameter for data sources such as the ObjectDataSource which used the value of a property on the page for a parameter.
I needed this functionality again so I found what I had previously written and improved it to make it more usable.



using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;

public class [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/09/07/asp-net-property-parameter-for-data-sources/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fill PDF Form Fields from an ASP.NET page using iTextSharp</title>
		<link>http://www.joe-stevens.com/2009/08/25/fill-pdf-form-fields-from-an-asp-net-page-using-itextsharp/</link>
		<comments>http://www.joe-stevens.com/2009/08/25/fill-pdf-form-fields-from-an-asp-net-page-using-itextsharp/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 03:59:59 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[abobe]]></category>
		<category><![CDATA[form field]]></category>
		<category><![CDATA[itext]]></category>
		<category><![CDATA[itextsharp]]></category>
		<category><![CDATA[mail merge]]></category>
		<category><![CDATA[mailmerge]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=222</guid>
		<description><![CDATA[Download the source code: PDFTest.zip
For a project I&#8217;m working on I needed to be able to generate PDF&#8217;s containing data from my page.  I came across a library called iTextSharp which is a C# port of the Java library iText.  Using this library allows you to generate PDF files on the fly.  You can download the [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/08/25/fill-pdf-form-fields-from-an-asp-net-page-using-itextsharp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using the CustomValidator&#8217;s ClientValidationFunction</title>
		<link>http://www.joe-stevens.com/2009/08/12/using-the-customvalidators-clientvalidationfunction/</link>
		<comments>http://www.joe-stevens.com/2009/08/12/using-the-customvalidators-clientvalidationfunction/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 04:02:31 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[clientvalidationfunction]]></category>
		<category><![CDATA[customvalidator]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=217</guid>
		<description><![CDATA[The ASP.NET CustomValidator allows you to create custom validation that fits into its validation framework.  The CustomValidator has a server side event called OnServerValidate and a client side event called ClientValidationFunction.
You can use the CustomValidator by just implementing the OnServerValidate event, but any other validation controls that are validated client side will need to be [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/08/12/using-the-customvalidators-clientvalidationfunction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show a JavaScript confirm dialog box after client validation</title>
		<link>http://www.joe-stevens.com/2009/08/12/show-a-javascript-confirm-dialog-box-after-client-validation/</link>
		<comments>http://www.joe-stevens.com/2009/08/12/show-a-javascript-confirm-dialog-box-after-client-validation/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 03:27:00 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[confirm]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=210</guid>
		<description><![CDATA[It&#8217;s quite common to use a JavaScript confirm dialog on a button press to ensure that the user wants to submit the page.  If you are using any of the ASP.NET validators that use client side validation you will find the confirm appears before the validation, whereas it would be better if the confirm box [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/08/12/show-a-javascript-confirm-dialog-box-after-client-validation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Generate a CSV from a generic list of objects using reflection and extension methods</title>
		<link>http://www.joe-stevens.com/2009/08/03/generate-a-csv-from-a-generic-list-of-objects-using-reflection-and-extension-methods/</link>
		<comments>http://www.joe-stevens.com/2009/08/03/generate-a-csv-from-a-generic-list-of-objects-using-reflection-and-extension-methods/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 04:09:59 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[extension method]]></category>
		<category><![CDATA[generic list]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=191</guid>
		<description><![CDATA[Download the source code for this post: ReflectionCSV.zip
Last week I wrote a post about generating a CSV from a DataTable. As I hardly use DataTables these days I thought it would be good to write a function that does this for a generic list of objects using reflection to get the properties of the object [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/08/03/generate-a-csv-from-a-generic-list-of-objects-using-reflection-and-extension-methods/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>ObjectDataSource &#8211; Cannot convert value of parameter value from System.String to System.DateTime</title>
		<link>http://www.joe-stevens.com/2009/07/30/objectdatasource-cannot-convert-value-of-parameter-value-from-system-string-to-system-datetime/</link>
		<comments>http://www.joe-stevens.com/2009/07/30/objectdatasource-cannot-convert-value-of-parameter-value-from-system-string-to-system-datetime/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 07:07:44 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[ObjectDataSource]]></category>

		<guid isPermaLink="false">http://www.joe-stevens.com/?p=179</guid>
		<description><![CDATA[One bug I&#8217;ve come across a few times and again just recently is when using an ObjectDataSource with a GridView to update dates.  When doing the update the ObjectDataSource always uses the en-US culture and not the culture defined for the application.
The bug has been acknowledged by Microsoft but never fixed.
If you are in the US then [...]]]></description>
		<wfw:commentRss>http://www.joe-stevens.com/2009/07/30/objectdatasource-cannot-convert-value-of-parameter-value-from-system-string-to-system-datetime/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
