<?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>uhri.com &#187; .NET</title>
	<atom:link href="http://uhri.com/blog/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://uhri.com/blog</link>
	<description>Taste is in the tongue of the beholder</description>
	<lastBuildDate>Wed, 16 Mar 2011 17:24:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ASP.NET 2.0 Master Pages &#8211; Referencing style sheets</title>
		<link>http://uhri.com/blog/aspnet-20-master-pages-referencing-style-sheets/</link>
		<comments>http://uhri.com/blog/aspnet-20-master-pages-referencing-style-sheets/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 17:15:57 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://uhri.com/blog/index.php/archive/aspnet-20-master-pages-referencing-style-sheets/</guid>
		<description><![CDATA[Here&#8217;s one of those things I&#8217;m always forgetting, and since most of my work is on-site at clients, I don&#8217;t have a large source code repository to go back to reference. To correctly reference a style sheet from within a master page in ASP.NET, use the following: &#60;link rel="stylesheet" href="&#60;%= ResolveUrl("~/css/screen.css") %&#62;" type="text/css" media="screen, projection" [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s one of those things I&#8217;m always forgetting, and since most of my work is on-site at clients, I don&#8217;t have a large source code repository to go back to reference.</p>
<p>To correctly reference a style sheet from within a master page in ASP.NET, use the following:</p>
<p><code class="block"><br />
&lt;link rel="stylesheet" href="&lt;%= ResolveUrl("~/css/screen.css") %&gt;" type="text/css" media="screen, projection" /&gt;<br />
</code></p>
<p>It&#8217;s the ResolveUrl that does the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/aspnet-20-master-pages-referencing-style-sheets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>&#8216;ConfigurationManager&#8217; is not a member of &#8216;Configuration&#8217;</title>
		<link>http://uhri.com/blog/configurationmanager-is-not-a-member-of-configuration/</link>
		<comments>http://uhri.com/blog/configurationmanager-is-not-a-member-of-configuration/#comments</comments>
		<pubDate>Fri, 30 Mar 2007 23:27:47 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://uhri.com/blog/index.php/archive/configurationmanager-is-not-a-member-of-configuration/</guid>
		<description><![CDATA[At the risk of appearing to be an idiot, I&#8217;m going to blog this so I don&#8217;t forget. Especially since it bit me twice *in the same project*. Oops. In .NET 2.0, the old method of getting information from the app.config has been depreciated. The new method is: ConfigurationManager.ConnectionStrings.Item(YourDB).ConnectionString For this to work, though, you [...]]]></description>
			<content:encoded><![CDATA[<p>At the risk of appearing to be an idiot, I&#8217;m going to blog this so I don&#8217;t forget. Especially since it bit me twice *in the same project*. Oops.</p>
<p>In .NET 2.0, the old method of getting information from the app.config has been depreciated.  The new method is:</p>
<p><code class="block"><br />
ConfigurationManager.ConnectionStrings.Item(<i>YourDB</i>).ConnectionString<br />
</code></p>
<p>For this to work, though, you need to remember to add a reference to <code>System.Configuration</code>.  This needs to be done for each project in the solution that uses it.  Thankfully I figured out that last bit pretty quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/configurationmanager-is-not-a-member-of-configuration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>me.ShowDialog() and LoaderLock</title>
		<link>http://uhri.com/blog/meshowdialog-and-loaderlock/</link>
		<comments>http://uhri.com/blog/meshowdialog-and-loaderlock/#comments</comments>
		<pubDate>Wed, 28 Mar 2007 14:00:02 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://uhri.com/blog/index.php/archive/meshowdialog-and-loaderlock/</guid>
		<description><![CDATA[I like to keep a good separation between forms and function in Windows applications I write. So to call a login form, I might call a public function on the login form like: Login.GetLogin(loginName, password). GetLogin might look like this (VB.NET): Public Function GetLogin(ByVal strLogin As String, ByVal strPassword As String) As Integer &#160;&#160;&#160;txtLogin.Text = [...]]]></description>
			<content:encoded><![CDATA[<p>I like to keep a good separation between forms and function in Windows applications I write.  So to call a login form, I might call a public function on the login form like: <code>Login.GetLogin(loginName, password)</code>.</p>
<p><span id="more-339"></span></p>
<p>GetLogin might look like this (VB.NET):</p>
<p><code class="block"><br />
Public Function GetLogin(ByVal strLogin As String, ByVal strPassword As String) As Integer<br />
&nbsp;&nbsp;&nbsp;txtLogin.Text = strLogin.Trim<br />
&nbsp;&nbsp;&nbsp;txtPassword.Text = strPassword.Trim<br />
&nbsp;&nbsp;&nbsp;Me.ShowDialog()<br />
&nbsp;&nbsp;&nbsp;Return mintToken<br />
End Function<br />
</code></p>
<p>In .NET 2.0 and Visual Studio 2005, this causes an exception to pop-up:</p>
<blockquote><p>LoaderLock was detected</p>
<p>Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.</p>
</blockquote>
<p>This exception is thrown on the first keystroke of my login form.</p>
<p>This seems to be a common problem, and the solution is to shut off the LoaderLock MDA (Managed Debugging Assistant).  This can be done in the menu <code>Debug -> Exceptions -> Managed Debug Assistants</code> and unchecking the <code>LoaderLock</code> option.  I don&#8217;t like this solution, but it seems to work.</p>
<p>This Microsoft KB Article on <a href="http://msdn2.microsoft.com/en-us/library/ms172219.aspx#CommunityContent">LoaderLock</a> contains some good information about this issue.  One of the commenters stated they had the same problem with an application throwing this each time a key is pressed, but no one has replied with a reason why.  My Visual Studio 2005 project contains a form originally designed in VS 2003.  I don&#8217;t know if that has something to do with it or not.</p>
<p>Hat tip: chrisB.  Also <a href="http://www.harriyott.com/2006/08/loaderlock-was-detected.aspx">Simon&#8217;s Software Stuff</a>p</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/meshowdialog-and-loaderlock/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASP.NET ListItems are by reference</title>
		<link>http://uhri.com/blog/aspnet-listitems-are-by-reference/</link>
		<comments>http://uhri.com/blog/aspnet-listitems-are-by-reference/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 14:00:49 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/index.php/archive/aspnet-listitems-are-by-reference/</guid>
		<description><![CDATA[I was trying to add yes / no values to three dropdowns on my ASP.NET page. We&#8217;re using custom drop down controls, so I needed to add the dropdown items in code behind. Always liking to be efficient in my code and make it pretty, I used this: ListItem listItem; listItem = new ListItem("No", "0"); [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to add yes / no values to three dropdowns on my ASP.NET page.  We&#8217;re using custom drop down controls, so I needed to add the dropdown items in code behind. Always liking to be efficient in my code and make it pretty, I used this:</p>
<p><span id="more-297"></span><br />
<code class="block"><br />
ListItem listItem;<br />
<br />
listItem = new ListItem("No", "0");<br />
DropDown1.Items.Add(listItem);<br />
DropDown2.Items.Add(listItem);<br />
DropDown3.Items.Add(listItem);<br />
<br />
listItem = new ListItem("Yes", "1");<br />
DropDown1.Items.Add(listItem);<br />
DropDown2.Items.Add(listItem);<br />
DropDown3.Items.Add(listItem);<br />
</code></p>
<p>Later, I&#8217;m loading my values from the database like this:</p>
<p><code class="block"><br />
DropDown1.SelectedValue = data.IsBool1 ? "1" : "0";<br />
DropDown2.SelectedValue = data.IsBool2 ? "1" : "0";<br />
DropDown3.SelectedValue = data.IsBool3 ? "1" : "0";<br />
</code></p>
<p>However, it turns out that when you do it this way, whenever <code class="inline">DropDown3</code> is changed, the same value will be chosen for <code class="inline">DropDown1</code> and <code>DropDown2</code> as well. ASP.NET keeps track of the <code class="inline">ListItem</code> objects by reference.</p>
<p>The correct way to do this should be:</p>
<p><code class="block"><br />
DropDown1.Items.Add(new ListItem("No","0"));<br />
DropDown1.Items.Add(new ListItem("Yes","1"));<br />
<br />
DropDown2.Items.Add(new ListItem("No","0"));<br />
DropDown2.Items.Add(new ListItem("Yes","1"));<br />
<br />
DropDown2.Items.Add(new ListItem("No","0"));<br />
DropDown2.Items.Add(new ListItem("Yes","1"));<br />
</code></p>
<p>I guess this is technically less lines of code, but I was thinking creating new <code class="inline">ListItem</code> objects each time would be less efficient than my original code. Not that a nanosecond will make any perceivable difference.</p>
<p>I guess it&#8217;s refactoring time!</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/aspnet-listitems-are-by-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enter key on ASP.NET 2.0 forms</title>
		<link>http://uhri.com/blog/enter-key-on-aspnet-20-forms/</link>
		<comments>http://uhri.com/blog/enter-key-on-aspnet-20-forms/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 14:00:40 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/index.php/archive/enter-key-on-aspnet-20-forms/</guid>
		<description><![CDATA[One piece of functionality that is often requested is the ability to submit a web form using the &#60;enter&#62; key. In some cases, you may need multiple textbox controls to submit differently by defaulting to different buttons. In the past there have been various javascript hacks to ensure this works successfully, but in ASP.NET 2.0 [...]]]></description>
			<content:encoded><![CDATA[<p>One piece of functionality that is often requested is the ability to submit a web form using the <code>&lt;enter&gt;</code> key.   In some cases, you may need multiple textbox controls to submit differently by defaulting to different buttons.  In the past there have been various javascript hacks to ensure this works successfully, but in ASP.NET 2.0 there is a simpler function.</p>
<p>By setting the <code>defaultbutton</code> property on a form or &#8211; even better &#8211; an <code>&lt;ASP:Panel&gt;</code> control, the page automatically handles it for you.  Each set of controls which should submit with a certain button can be contained in the panel and everything is hooked up automagically.</p>
<p>One caveat: If you set a default button on a panel but not in the form, other controls seem to use the panel&#8217;s default button even when they are not in the panel.</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/enter-key-on-aspnet-20-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s official&#8230; I like C# better than VB.NET</title>
		<link>http://uhri.com/blog/its-official-i-like-c-better-than-vbnet/</link>
		<comments>http://uhri.com/blog/its-official-i-like-c-better-than-vbnet/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 14:00:11 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/index.php/archive/its-official-i-like-c-better-than-vbnet/</guid>
		<description><![CDATA[Yes, it is true, I&#8217;ve switched to the dark side. The last bastions of VB.NET have fallen. After a conversation with a pair of developers I work with, I have finally been convinced that C# is a better syntax than VB.NET. That&#8217;s saying something, considering I used to believe I liked my languages verbose. You [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, it is true, I&#8217;ve switched to the dark side.  The last bastions of VB.NET have fallen.</p>
<p>After a conversation with a pair of developers I work with, I have finally been convinced that C# is a better syntax than VB.NET.  That&#8217;s saying something, considering I used to believe I liked my languages verbose.  You know, like COBOL.  There were three things in the C-based syntax of the language that bothered me:</p>
<ul>
<li>Case sensitivity</li>
<li>Curly braces</li>
<li>Semicolons</li>
</ul>
<p><span id="more-294"></span>
</p>
<p>Like me, one developer was a former VB programmer now a fan of C#.  The other was more of an open source proponent, but extremely knowledgeable about programming theory and history.  A discussion with these two and some time <em>actually developing</em> in C# helped me understand the power of the language and the benefits over VB.NET syntax.  I would still like to point out that the IDE in Visual Studio could use a few more features to truly make C# programming outstanding.  I guess <a href="http://www.jetbrains.com/resharper/" title="Resharper">Resharper</a> will have to fill the gap.</p>
<h5>Case sensitivity</h5>
<p>For the longest time, I could not come up with a decent reason for a case sensitive language.  In VB.NET&#8217;s case-insensitive world, the IDE can auto correct your tYpInG mistakes very easily.  It isn&#8217;t as easy to do in a case-sensitive language, because the IDE will not know &#8220;var&#8221; verses &#8220;Var&#8221; verses &#8220;VAR&#8221; when all three are in use.  I have found case-sensitivity to make sense in naming variables, especially in the <a href="http://www.joelonsoftware.com/articles/Wrong.html">post Hungarian Notation</a> world.  I can declare a variable and name it the same as the class on which it is based. For example:</p>
<p><code>Customer customer = new Customer();</code></p>
<p>I don&#8217;t have to spend any time coming up with a different variable name.  It actually requires <em>less</em> thinking.  Less thinking is good.</p>
<h5>Curly Braces</h5>
<p>My previous experience with C-based languages was in college, circa 1994.  Back then, there were no fancy IDEs, we coded in a text editor and we liked it that way!</p>
<p>Ok, I didn&#8217;t.</p>
<p>Formatting a document was a giant pain, but I had to do it to my curly braces straight.  With VB&#8217;s <code class="inline">If.. End If</code> structure, I could read where the end of a statement was without tracing back and forth.  Admittedly, Visual Studio can be thanked for fixing a lot of this issue in C#.  It will auto-format a document for you and highlights bracket pairs.  A number of other IDEs have done this for c-based languages as well.</p>
<p>What I hadn&#8217;t realized was how symbology makes it <em>easier</em> to understand the code.  By using curly braces and other short constructs that are not words, C-based languages become easier to understand.  My mind spends less time translating the code when I read it because the braces fade into the background.  I can focus on the important things instead &#8211; the actual code.</p>
<p>It actually requires <em>less</em> thinking, and less thinking is good.</p>
<h5>Semicolons</h5>
<p>This one is more of a religious debate than anything else. I used to prefer not having to end statements with a semi-colon, choosing instead to use a line delimiter for continuation.  That worked out fine and dandy until I needed to reformat a line &#8211; it involved moving the delimiters.  In C# I hit enter and I&#8217;m done.</p>
<p>You know&#8230; <em>less thinking</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/its-official-i-like-c-better-than-vbnet/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>ASP.NET: Referencing ClientID in a Repeater</title>
		<link>http://uhri.com/blog/aspnet-referencing-clientid-in-a-repeater/</link>
		<comments>http://uhri.com/blog/aspnet-referencing-clientid-in-a-repeater/#comments</comments>
		<pubDate>Mon, 20 Nov 2006 14:00:25 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/index.php/archive/aspnet-referencing-clientid-in-a-repeater/</guid>
		<description><![CDATA[On my client&#8217;s project one of my tasks was to write a search engine and corresponding UI screen. The results of the search are displayed using an asp:Repeater control in a pattern similar to Google. One more requirement is a section that pops open to reveal additional, less-frequently-used actions. Sort of a &#8220;dropdown&#8221; of more [...]]]></description>
			<content:encoded><![CDATA[<p>On my client&#8217;s project one of my tasks was to write a search engine and corresponding UI screen.  The results of the search are displayed using an <code>asp:Repeater</code> control in a pattern similar to <a href="http://google.com" title="Google search">Google</a>.  One more requirement is a section that pops open to reveal additional, less-frequently-used actions. Sort of a &#8220;dropdown&#8221; of more options.</p>
<p>I thought I would use a hyperlink with a call to javascript that toggles the display of a <code>&lt;div&gt;</code>.  It seemed like the best solution within the context of the existing page.</p>
<p>With that in mind, I added some javascript to my ASP.NET page  (using <code>RegisterClientScriptBlock</code>) without a problem. But when it came to adding the &#8220;more&#8221; link and the show/hide div, I ran into a serious issue.</p>
<p>What I really wanted to do in the repeater&#8217;s <code>ItemTemplate</code> was:<br />
<code class="block">&lt;ItemTemplate&gt;<br />
&lt;a href="javascript:toggleDisplay('&lt;%=pnlMoreLinks.ClientID%&gt;');"&gt;show / hide&lt;/a&gt;<br />
&lt;asp:Panel runat="server" ID="pnlMoreLinks" CssClass="morelinks"&gt;<br />
Show and hide me!<br />
&lt;/asp:Panel&gt;<br />
&lt;ItemTemplate&gt;</code></p>
<p>My thought was that it would render code to the browser along the lines of:<br />
<code class="block">&lt;a href="javascript:toggleDisplay( 'ctl00_ContentPage_Repeater_ctl01_pnlMoreLinks');"&gt;show / hide&lt;/a&gt;<br />
&lt;div id="ctl00_ContentPage_Repeater_ctl01_pnlMoreLinks" class="moreLinks"&gt;<br />
Show and hide me!<br />
&lt;/div&gt;</code>
</p>
<p>The problem is that causes a compile error:<br />
<code class="block">The name 'pnlMoreLinks' does not exist in the current context</code>
</p>
<p>Not good. Outside of the repeater, the <code>&lt;%=pnlMoreLinks.ClientID%&gt;</code> works beautifully.  Inside the repeater: compile error.  It seems the reference to the <code>asp:panel</code> is not available to other controls in the designer.  In case you were wondering, proximity had no effect either.</p>
<p>A quick check with the other smart people led to no real epiphanies though the designer.  In the end, I manually set the reference in the link to the ClientID of the panel through the ItemDataBound event on the repeater.  In the code behind, this method lets you control the formatting of each row as its being rendered.  The ClientID of the panel is available at this point of the page&#8217;s life cycle.</p>
<p><code class="block">protected void rptSearchResults_ItemDataBound(object sender, RepeaterItemEventArgs e) {<br />
&nbsp;&nbsp;&nbsp;HyperLink link = (HyperLink)e.Item.FindControl("lnkMoreLinks");<br />
&nbsp;&nbsp;&nbsp;Panel panel = (Panel)e.Item.FindControl("pnlMoreLinks");<br />
&nbsp;&nbsp;&nbsp;if (panel != null &#038;&#038; link != null)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;link.NavigateUrl = "javascript:toggleDisplay('" + panel.ClientID + "');";<br />
}</code>
</p>
<p>The repeater&#8217;s ItemDataBound method has been invaluable to me in a few other tasks&#8230; having more control of the repeater than is provided by the designer and data binding is essential to usable, well-built web apps.</p>
<p>And now I have a hide-able div in a repeater control. Sweet. </p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/aspnet-referencing-clientid-in-a-repeater/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OPC, DCOM and XP SP2</title>
		<link>http://uhri.com/blog/opc-dcom-and-xp-sp2/</link>
		<comments>http://uhri.com/blog/opc-dcom-and-xp-sp2/#comments</comments>
		<pubDate>Tue, 14 Mar 2006 21:39:59 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/index.php/archive/opc-dcom-and-xp-sp2/</guid>
		<description><![CDATA[DCOM, it turns out, is #2 on the all time Spawn of Satan list.  I haven&#8217;t run into a project with more problems than the one using OLE for Process Control (OLE) over DCOM. This week&#8217;s adventure happened because the client upgraded their machine to Service Pack 2 of Windows XP.  Most in the tech [...]]]></description>
			<content:encoded><![CDATA[<p>DCOM, it turns out, is #2 on the all time Spawn of Satan list.  I haven&#8217;t run into a project with more problems than the one using OLE for Process Control (OLE) over DCOM.</p>
<p>This week&#8217;s adventure happened because the client upgraded their machine to Service Pack 2 of Windows XP.  Most in the tech industry know it was rolled out to curb zombie PCs.  So the firewall and nearly everything else was closed down.  Without being told about the upgrade, I was at the client site trying to figure out what was wrong.</p>
<p>Fixing the problem was relatively simple once I Googled <a target="_blank" href="http://www.google.com/search?sourceid=mozclient&#038;ie=utf-8&#038;oe=utf-8&#038;q=dcom+changes+in+sp2">DCOM changes in SP2</a>.  In fact, I even found an article on the OPC Foundation&#8217;s website on <a target="_blank" href="http://www.opcfoundation.org/DownloadFile.aspx?CM=3&#038;RI=161&#038;CN=KEY&#038;CI=282&#038;CU=1">Using OPC via DCOM with Windows XP Service Pack 2</a> (direct <a href="http://www.opcfoundation.org/DownloadFile.aspx/Using%20OPC%20via%20DCOM%20with%20XP%20SP2.pdf?RI=161">link to the .pdf</a>).</p>
<p>(Hat tip to Professor Z.)</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/opc-dcom-and-xp-sp2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASP.NET &#8211; Adding a blank value to a data-bound dropdownlist</title>
		<link>http://uhri.com/blog/aspnet-adding-a-blank-value-to-a-data-bound-dropdownlist/</link>
		<comments>http://uhri.com/blog/aspnet-adding-a-blank-value-to-a-data-bound-dropdownlist/#comments</comments>
		<pubDate>Thu, 23 Feb 2006 20:33:57 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/index.php/archive/aspnet-adding-a-blank-value-to-a-data-bound-dropdownlist/</guid>
		<description><![CDATA[For some reason I can&#8217;t seem to remember this when I need it. If you have a dropdownlist in ASP.NET: If this dropdownlist is databound: DataSet ds = new DataSet(); ds.ReadXml(Server.MapPath("states.xml")); states.DataSource = ds; states.DataBind(); ...and you want to add a blank value to ensure the user has selected a value, do the following: states.Items.Insert(0,""); [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason I can&#8217;t seem to remember this when I need it.</p>
<p>If you have a dropdownlist in ASP.NET:</p>
<p><code><</code><code>asp:dropdownlist id="states" runat="server"</code><code>></code></p>
<p>If this dropdownlist is databound:</p>
<p><code> DataSet ds = new DataSet();<br />
ds.ReadXml(Server.MapPath("states.xml"));<br />
states.DataSource = ds;<br />
states.DataBind();</code></p>
<p>...and you want to add a blank value to ensure the user has selected a value, do the following:</p>
<p><code> states.Items.Insert(0,""); </code></p>
<p>You can substitute any value for the blank string, such as "--select--".</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/aspnet-adding-a-blank-value-to-a-data-bound-dropdownlist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Not-Invented-Here Syndrome</title>
		<link>http://uhri.com/blog/not-invented-here-syndrome/</link>
		<comments>http://uhri.com/blog/not-invented-here-syndrome/#comments</comments>
		<pubDate>Wed, 01 Feb 2006 12:51:09 +0000</pubDate>
		<dc:creator>y0mbo</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.uhri.com/blog/?p=231</guid>
		<description><![CDATA[I finally got over the Not-Invented-Here (NIH) Syndrome about the blog here at Uhri.com. Wow, what a relief. In 2000, when I first set up this website, I decided I would write my own app to add posts to the front page. These became known as Spectacularities. I&#8217;m not sure that at the time the [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got over the Not-Invented-Here (NIH) Syndrome about the blog here at Uhri.com. Wow, what a relief.</p>
<p>In 2000, when I first set up this website, I decided I would write my own app to add posts to the front page.  These became known as Spectacularities.  I&#8217;m not sure that at the time the word &#8220;blog&#8221; even existed.  It certainly hadn&#8217;t caught on by that point if it did.  Essentially, I was building software for blogging.</p>
<p>I wrote a quick little utility to add Spectacularities to the home page.  It consisted of a user control for displaying the page, a single form for post entry, and one database table.  It was enough to get things working that day and I was happily on my way.  I never intended for my little blogging app to stay as small as it was.  I never intended for it to end up as decrepit as it did.</p>
<p>For reasons I can&#8217;t remember at the moment, the admin page eventually fell into disuse.  Something broke and I just never fixed it.  It may have been right around the time .NET arrived and I never upgraded the page.  I switched instead to using the stored procedure directly in Query Analyzer to add and update my posts.  It was a lot of single quote manipulation and generally a pain in the rear.</p>
<p>Then the archive page, built using the said user control, began to get out of hand.  When three years of posts began to appear on it the load time was unbearable. I took the archive offline.</p>
<p>With just the current post displayed and a propped up SP, things really began to go downhill.  I posted less and less frequently. Finally, at the end of 2004, I put Uhri.com out of its misery.  The whole site got replaced by a single flatline graphic.  It was a sabbatical which lasted almost an entire year.</p>
<p>In September of 2005 I approached the problem with new vigor.  I came up with a new strategy for my own blogging software, tenatively dubbed &#8220;uBlog&#8221; (I thought it was a clever name, anyway).  I started the &#8220;very public&#8221; redesign of the site with requirements gathering and everything.  I put up use cases and details about how the site would be designed.  It was all part of my grand plan to write an XHTML and CSS-based blogging software in ASP.NET.</p>
<p>I started checking out the other blogging tools out there.  <a title="Wordpress.org" target="_blank" href="http://wordpress.org/">WordPress</a> had caught my attention on several occasions because of its standards compliance.  I reviewed <a title="dasBlog.net" target="_blank" href="http://www.dasblog.net/">dasBlog</a>, .Text and its fork <a target="_blank" title="Subtextproject.com" href="http://subtextproject.com/">SubText</a>, and a newcomer to the .NET blogging tools, <a target="_blank" title="vinetype.com" href="http://www.vinetype.com/">VineType</a>.  VineType seemed to be the most promising &#8212; a .NET-based blogging tool with XHTML standards.  I may still consider VineType in the future as their codebase grows.  The developers there seem to have a good thing started and while it may not grow to the size of WordPress, they do provide the basis of a good blogging system in ASP.NET.</p>
<p>As I reviewed these competitors, I came to a sinking realization.</p>
<p>I had NIH Syndrome.  I wanted to create my own tool with features the way I wanted them. I saw the thriving WordPress community and was jealous.  There were plug-ins for anything feature I could possible want.  With the exception of VineType, the .NET blogging tools looked like garbage. If I were to roll my own, I could make it as easy and beatiful as WordPress. But if I built my own software, I could never reach the critical mass of WordPress.  There wouldn&#8217;t be a community of developers building add-ins that would make a great .NET blogging application.  There just aren&#8217;t enough bloggers in the .NET world that would care.</p>
<p>I wust wasn&#8217;t sure I was ready for the kind of commitment involved in something that would most likely be unsuccessful.<br />
Joel probably <a target="_blank" title="Joel on Software" href="http://www.joelonsoftware.com/articles/fog0000000007.html">said it best</a>:</p>
<blockquote><p>If it&#8217;s a core business function &#8212; do it yourself, no matter what.</p></blockquote>
<p>As a corrollary, if it&#8217;s not a core business function, outsource it.<br />
It turns out blogging software isn&#8217;t a core business function.  Its not what I want to spend my free time doing.  I&#8217;m much more interested in the creation of content.  That&#8217;s what the blogging software is for, after all.  I&#8217;d be crazy to reinvent the wheel just to call it uWheel (hey, another catchy name).<br />
So I installed WordPress and haven&#8217;t looked back.</p>
]]></content:encoded>
			<wfw:commentRss>http://uhri.com/blog/not-invented-here-syndrome/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

