<?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>radical wacko &#187; Code</title> <atom:link href="http://www.radicalwacko.com/category/technology/code/feed/" rel="self" type="application/rss+xml" /><link>http://www.radicalwacko.com</link> <description>A Place of Unfettered Eccentricity</description> <lastBuildDate>Wed, 08 Feb 2012 03:43:33 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>TryParse and Nullable Types</title><link>http://www.radicalwacko.com/2009/01/29/tryparse-and-nullable-types/</link> <comments>http://www.radicalwacko.com/2009/01/29/tryparse-and-nullable-types/#comments</comments> <pubDate>Fri, 30 Jan 2009 00:23:05 +0000</pubDate> <dc:creator>RadicalWacko</dc:creator> <category><![CDATA[Code]]></category> <guid
isPermaLink="false">http://www.radicalwacko.com/index.php/2009/01/29/tryparse-and-nullable-types/</guid> <description><![CDATA[I just ran into an irritating little problem with using TryParse when assigning to nullable object.&#160; The following is the code I was using to assign a value from a ASP.NET dropdown list to a nullable Int32 variable: If Int32.TryParse(ddlExample.SelectedValue, testobj.TestNullableInt32 )Then testobj.TestDescription = ddlExample.SelectedItem.Text End If &#160; Apparently, TryParse actually attempts to access the <a
href='http://www.radicalwacko.com/2009/01/29/tryparse-and-nullable-types/'>[...]</a>]]></description> <content:encoded><![CDATA[<p>I just ran into an irritating little problem with using TryParse when assigning to nullable object.&nbsp; The following is the code I was using to assign a value from a ASP.NET dropdown list to a nullable Int32 variable:</p><pre class="csharpcode"><span class="kwrd">If</span> Int32.TryParse(ddlExample.SelectedValue, testobj.TestNullableInt32 )<span class="kwrd">Then</span>
     testobj.TestDescription = ddlExample.SelectedItem.Text
<span class="kwrd">End If</span></pre><style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><p>&nbsp;</p><p>Apparently, TryParse actually attempts to access the value of the object to which it attempts to assign the parsed value which can cause an InvalidOperationException when it attempts to retrieve the value of the nullable object.&nbsp; So make sure to assign the parsed value to a regular type before assigning it to a nullable object.&nbsp; Oh yeah, I know it’s VB.NET code, but I do what the client wants. <img
src='http://www.radicalwacko.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.radicalwacko.com/2009/01/29/tryparse-and-nullable-types/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Seeking Suggestions for Reading Web.Config</title><link>http://www.radicalwacko.com/2008/03/24/seeking-suggestions-for-reading-webconfig/</link> <comments>http://www.radicalwacko.com/2008/03/24/seeking-suggestions-for-reading-webconfig/#comments</comments> <pubDate>Mon, 24 Mar 2008 19:22:59 +0000</pubDate> <dc:creator>RadicalWacko</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[Tech]]></category> <guid
isPermaLink="false">http://www.radicalwacko.com/index.php/2008/03/24/seeking-suggestions-for-reading-webconfig/</guid> <description><![CDATA[I recently had a task in one of my current projects that required me to extract the authentication mode of the current solution&#8217;s web.config file. The only was I figured out how to do it was by parsing the XML of the file by hand as shown below (Yeah, I know, it&#8217;s VB.NET. I do <a
href='http://www.radicalwacko.com/2008/03/24/seeking-suggestions-for-reading-webconfig/'>[...]</a>]]></description> <content:encoded><![CDATA[<p>I recently had a task in one of my current projects that required me to extract the authentication mode of the current solution&#8217;s web.config file.  The only was I figured out how to do it was by parsing the XML of the file by hand as shown below (Yeah, I know, it&#8217;s VB.NET.  I do what the client wants.):</p><p
class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:f7306884-da16-4192-9389-70052adb2730" style="margin: 0px; padding: 0px; display: inline; float: none">&nbsp;</p><pre style="overflow: auto; background-color: White; font-family: Courier New; font-size: 14px; font-weight: bold"><span style="color: #000000">            </span><span style="color: #0000ff">Dim</span><span style="color: #000000"> config </span><span style="color: #0000ff">As</span><span style="color: #000000"> </span><span style="color: #0000ff">New</span><span style="color: #000000"> System.Xml.XmlDocument()
            config.Load(Server.MapPath(</span><span style="color: #800000">"</span><span style="color: #800000">\Web.config</span><span style="color: #800000">"</span><span style="color: #000000">))
            </span><span style="color: #0000ff">Dim</span><span style="color: #000000"> authMode </span><span style="color: #0000ff">As</span><span style="color: #000000"> System.Xml.XmlNode </span><span style="color: #000000">=</span><span style="color: #000000"> config.SelectSingleNode(</span><span style="color: #800000">"</span><span style="color: #800000">/configuration/system.web/authentication/@mode</span><span style="color: #800000">"</span><span style="color: #000000">)
            </span><span style="color: #0000ff">Return</span><span style="color: #000000"> authMode.Value</span></pre><p></p><p>While that works just fine, it seems a little primitive and I figured Microsoft would have introduced a library to get that kind of data.  Anyone know of any?</p> ]]></content:encoded> <wfw:commentRss>http://www.radicalwacko.com/2008/03/24/seeking-suggestions-for-reading-webconfig/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Setting Control Focus in an Ajax Update Panel</title><link>http://www.radicalwacko.com/2008/03/23/setting-control-focus-in-an-ajax-update-panel/</link> <comments>http://www.radicalwacko.com/2008/03/23/setting-control-focus-in-an-ajax-update-panel/#comments</comments> <pubDate>Sun, 23 Mar 2008 17:17:04 +0000</pubDate> <dc:creator>RadicalWacko</dc:creator> <category><![CDATA[Code]]></category> <category><![CDATA[Tech]]></category> <guid
isPermaLink="false">http://www.radicalwacko.com/index.php/2008/03/23/setting-control-focus-in-an-ajax-update-panel/</guid> <description><![CDATA[I&#8217;ve decided to start posting the solutions I find in irritating little problems that take me forever to find.&#160; Some of these will probably be obvious, but hopefully it might save someone&#8217;s time.&#160; My current problem was that I had a DotNetNuke module that was sitting in a AJAX Update Panel.&#160; I needed to set <a
href='http://www.radicalwacko.com/2008/03/23/setting-control-focus-in-an-ajax-update-panel/'>[...]</a>]]></description> <content:encoded><![CDATA[<p>I&#8217;ve decided to start posting the solutions I find in irritating little problems that take me forever to find.&nbsp; Some of these will probably be obvious, but hopefully it might save someone&#8217;s time.&nbsp; My current problem was that I had a DotNetNuke module that was sitting in a AJAX Update Panel.&nbsp; I needed to set the focus to a particular control based upon a post back click on a radio button.&nbsp; The standard focus() method didn&#8217;t work and neither did the old fashioned RegisterClientScriptBlock stuff with a provided JavaScript function.&nbsp; Turns out there is an extremely easy way to do this which is to use the ScriptManager SetFocus method using the base Page for the control as shown below:</p></p><div
class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:270db8d3-c12f-47ee-8088-9989433c2350" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color:White;;overflow: auto;;font-family:Courier New;font-size:12">
<div><span style="color: #000000;">ScriptManager.GetCurrent(</span><span style="color: #0000FF;">Me</span><span style="color: #000000;">.Page).SetFocus(txtApplicationDate)</span></div>
</pre><p></div></p><p>Hope that helps someone.</p> ]]></content:encoded> <wfw:commentRss>http://www.radicalwacko.com/2008/03/23/setting-control-focus-in-an-ajax-update-panel/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
