<?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>Prolific Notion &#187; .Net</title>
	<atom:link href="http://www.prolificnotion.co.uk/category/development/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.prolificnotion.co.uk</link>
	<description>Welcome to the miscellaneous mutterings of Simon Dingley, Freelance Web Developer</description>
	<lastBuildDate>Sat, 24 Jul 2010 14:23:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>C# Utility method to populate list controls with all countries as given in ISO 3166-1</title>
		<link>http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/</link>
		<comments>http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 20:36:03 +0000</pubDate>
		<dc:creator>Simon Dingley</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.prolificnotion.co.uk/?p=469</guid>
		<description><![CDATA[Most projects I work on need a list of countries at some point so I put together a snippet of SQL that I could reuse to create and populate a countries table in the database with all countries as given in ISO 3166-1. After recently writing a utility class to populate list controls with world [...]


Related posts:<ol><li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with world currencies'>C# Utility method to populate list controls with world currencies</a> <small>A requirement that came up recently required a drop down...</small></li>
<li><a href='http://www.prolificnotion.co.uk/umbraco-locate-nearest-node-with-specific-property/' rel='bookmark' title='Permanent Link: Umbraco : Locate nearest node with specific property'>Umbraco : Locate nearest node with specific property</a> <small>In an ongoing project I am working on I needed...</small></li>
<li><a href='http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/' rel='bookmark' title='Permanent Link: Convert HTML to Plain Text in C# using Markdown'>Convert HTML to Plain Text in C# using Markdown</a> <small>Creating a plain-text version of HTML that is suitable to...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.prolificnotion.co.uk%2Fc-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.prolificnotion.co.uk%2Fc-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1%2F&amp;style=normal&amp;service=bit.ly&amp;service_api=R_e35365ff035ed93fc3e67e6f868b7be3" height="61" width="50" /><br />
			</a>
		</div>
<p>Most projects I work on need a list of countries at some point so I put together a snippet of SQL that I could reuse to create and populate a countries table in the database with all countries as given in <a title="English country names and code elements" href="http://www.iso.org/iso/english_country_names_and_code_elements">ISO 3166-1</a>. After recently writing <a title="How to populate a ListControl with currency options" href="http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/">a utility class to populate list controls with world currencies</a> according to <a title="ISO 4217 currency and funds name and code elements" href="http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm">ISO 4217</a> it got me wondering if I could also do the same for countries using only the .Net Framework. And so I came up with the following utility class to do the job.</p>
<pre class="brush: csharp;">        /// &lt;summary&gt;
        /// Populates the list control with countries as given by ISO 4217.
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;ctrl&quot;&gt;The list control to populate.&lt;/param&gt;
        public static void FillWithISOCountries(ListControl ctrl)
        {
            foreach (CultureInfo cultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
            {
                RegionInfo regionInfo = new RegionInfo(cultureInfo.LCID);
                if (ctrl.Items.FindByValue(regionInfo.TwoLetterISORegionName) == null)
                {
                    ctrl.Items.Add(new ListItem(regionInfo.EnglishName, regionInfo.TwoLetterISORegionName));
                }
            }

            RegionInfo currentRegionInfo = new RegionInfo(CultureInfo.CurrentCulture.LCID);

            //- Default the selection to the current cultures country
            if (ctrl.Items.FindByValue(currentRegionInfo.TwoLetterISORegionName) != null)
            {
                ctrl.Items.FindByValue(currentRegionInfo.TwoLetterISORegionName).Selected = true;
            }
        }</pre>


<p>Related posts:<ol><li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with world currencies'>C# Utility method to populate list controls with world currencies</a> <small>A requirement that came up recently required a drop down...</small></li>
<li><a href='http://www.prolificnotion.co.uk/umbraco-locate-nearest-node-with-specific-property/' rel='bookmark' title='Permanent Link: Umbraco : Locate nearest node with specific property'>Umbraco : Locate nearest node with specific property</a> <small>In an ongoing project I am working on I needed...</small></li>
<li><a href='http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/' rel='bookmark' title='Permanent Link: Convert HTML to Plain Text in C# using Markdown'>Convert HTML to Plain Text in C# using Markdown</a> <small>Creating a plain-text version of HTML that is suitable to...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# Utility method to populate list controls with world currencies</title>
		<link>http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/</link>
		<comments>http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/#comments</comments>
		<pubDate>Thu, 06 May 2010 09:40:07 +0000</pubDate>
		<dc:creator>Simon Dingley</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.prolificnotion.co.uk/?p=400</guid>
		<description><![CDATA[A requirement that came up recently required a drop down list of world currencies. I developed a reusable method for populating a ListControl with World Currencies using components from the .Net Framework alone.


Related posts:<ol><li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with all countries as given in ISO 3166-1'>C# Utility method to populate list controls with all countries as given in ISO 3166-1</a> <small>Most projects I work on need a list of countries...</small></li>
<li><a href='http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/' rel='bookmark' title='Permanent Link: Convert HTML to Plain Text in C# using Markdown'>Convert HTML to Plain Text in C# using Markdown</a> <small>Creating a plain-text version of HTML that is suitable to...</small></li>
<li><a href='http://www.prolificnotion.co.uk/umbraco-locate-nearest-node-with-specific-property/' rel='bookmark' title='Permanent Link: Umbraco : Locate nearest node with specific property'>Umbraco : Locate nearest node with specific property</a> <small>In an ongoing project I am working on I needed...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.prolificnotion.co.uk%2Fc-utility-method-to-populate-list-controls-with-world-currencies%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.prolificnotion.co.uk%2Fc-utility-method-to-populate-list-controls-with-world-currencies%2F&amp;style=normal&amp;service=bit.ly&amp;service_api=R_e35365ff035ed93fc3e67e6f868b7be3" height="61" width="50" /><br />
			</a>
		</div>
<p>I am working on a Job File System (JFS) for a client and they had the requirement to include a drop down list of currencies on their Purchase Order and Invoice documents, at first I was going to manually put together a list control but on reflection I thought their must be a better way of doing this that is more reusable. So here I have a utility method I put together to populate a ListControl with currency options. I would be interested in any feedback on this and alternative/better methods of achieving the end result:</p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Fills the ListControl with ISO currency symbols.
/// &lt;/summary&gt;
/// &lt;param name=&quot;ctrl&quot;&gt;The ListControl.&lt;/param&gt;
public static void FillWithISOCurrencySymbols(ListControl ctrl)
{
	foreach (CultureInfo cultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
	{
		RegionInfo regionInfo = new RegionInfo(cultureInfo.LCID);
		if (ctrl.Items.FindByValue(regionInfo.ISOCurrencySymbol) == null)
		{
			ctrl.Items.Add(new ListItem(regionInfo.CurrencyEnglishName, regionInfo.ISOCurrencySymbol));
		}
	}

	RegionInfo currentRegionInfo = new RegionInfo(CultureInfo.CurrentCulture.LCID);

	//- Default the selection to the current cultures currency symbol
	if (ctrl.Items.FindByValue(currentRegionInfo.ISOCurrencySymbol) != null)
	{
		ctrl.Items.FindByValue(currentRegionInfo.ISOCurrencySymbol).Selected = true;
	}
}
</pre>


<p>Related posts:<ol><li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with all countries as given in ISO 3166-1'>C# Utility method to populate list controls with all countries as given in ISO 3166-1</a> <small>Most projects I work on need a list of countries...</small></li>
<li><a href='http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/' rel='bookmark' title='Permanent Link: Convert HTML to Plain Text in C# using Markdown'>Convert HTML to Plain Text in C# using Markdown</a> <small>Creating a plain-text version of HTML that is suitable to...</small></li>
<li><a href='http://www.prolificnotion.co.uk/umbraco-locate-nearest-node-with-specific-property/' rel='bookmark' title='Permanent Link: Umbraco : Locate nearest node with specific property'>Umbraco : Locate nearest node with specific property</a> <small>In an ongoing project I am working on I needed...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Convert HTML to Plain Text in C# using Markdown</title>
		<link>http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/</link>
		<comments>http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 13:41:12 +0000</pubDate>
		<dc:creator>Simon Dingley</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Umbraco]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.prolificnotion.co.uk/?p=262</guid>
		<description><![CDATA[Creating a plain-text version of HTML that is suitable to be sent out as the text part of a multi-part email. Using C# and XSLT I have developed a working solution to the problem with help from a third party markdown XSLT file.


Related posts:<ol><li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with world currencies'>C# Utility method to populate list controls with world currencies</a> <small>A requirement that came up recently required a drop down...</small></li>
<li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with all countries as given in ISO 3166-1'>C# Utility method to populate list controls with all countries as given in ISO 3166-1</a> <small>Most projects I work on need a list of countries...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.prolificnotion.co.uk%2Fconvert-html-to-plain-text-in-c-using-markdown%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.prolificnotion.co.uk%2Fconvert-html-to-plain-text-in-c-using-markdown%2F&amp;style=normal&amp;service=bit.ly&amp;service_api=R_e35365ff035ed93fc3e67e6f868b7be3" height="61" width="50" /><br />
			</a>
		</div>
<p>While working on my customisations to <a style="outline-style: none; outline-width: initial; outline-color: initial; color: #33707e; text-decoration: underline; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.nibble.be/">Tim Geyssens</a> <a style="outline-style: none; outline-width: initial; outline-color: initial; color: #33707e; text-decoration: underline; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.nibble.be/?p=63">MailEngine</a> I was looking for an accurate method of automatically creating a plain-text version of the HTML emails that were being sent out by the site. Further reading brought my attention to something called <a title="Read more about Markdown here" href="http://en.wikipedia.org/wiki/Markdown">Markdown</a>. After some hunting around with a little help from my friend Google I managed to find a markdown XSLT file. Using the XSLT I could transform my HTML email to plain-text with relative ease and accuracy. Of course in order to do this I would need a valid XML document and as my pages were already valid XHTML I had no problems there.</p>
<p>Here is my method for doing the conversion, all it requires is that you pass it the HTML you want to convert which must be valid XML:</p>
<pre class="brush: csharp;">/// &lt;summary&gt;
/// Converts to HTML to plain-text.
/// &lt;/summary&gt;
/// &lt;param name=&quot;HTML&quot;&gt;The HTML.&lt;/param&gt;
/// &lt;returns&gt;The plain text representation of the HTML&lt;/returns&gt;
private static string ConvertToText(string HTML)
{
    string text = string.Empty;

    XmlDocument xmlDoc = new XmlDocument();
    XmlDocument xsl = new XmlDocument();
    xmlDoc.LoadXml(HTML);
    xsl.CreateEntityReference(&quot;nbsp&quot;);
    xsl.Load(System.Web.HttpContext.Current.Server.MapPath(&quot;/xslt/Markdown.xslt&quot;));

    //creating xslt
    XslTransform xslt = new XslTransform();
    xslt.Load(xsl, null, null);

    //creating stringwriter
    StringWriter writer = new System.IO.StringWriter();

    //Transform the xml.
    xslt.Transform(xmlDoc, null, writer, null);

    //return string
    text = writer.ToString();
    writer.Close();

    return text;
}</pre>
<p>Download the XSLT file I used from here:</p>
<p><a href="http://symphony-cms.com/downloads/xslt/file/20573/">http://symphony-cms.com/downloads/xslt/file/20573/</a></p>
<p>I would love to hear from anyone that does this differently or if you can find any problems with the method I have chosen to implement for this solution.</p>


<p>Related posts:<ol><li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-world-currencies/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with world currencies'>C# Utility method to populate list controls with world currencies</a> <small>A requirement that came up recently required a drop down...</small></li>
<li><a href='http://www.prolificnotion.co.uk/c-utility-method-to-populate-list-controls-with-all-countries-as-given-in-iso-3166-1/' rel='bookmark' title='Permanent Link: C# Utility method to populate list controls with all countries as given in ISO 3166-1'>C# Utility method to populate list controls with all countries as given in ISO 3166-1</a> <small>Most projects I work on need a list of countries...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.prolificnotion.co.uk/convert-html-to-plain-text-in-c-using-markdown/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
