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

<channel>
	<title>Developing ASP</title>
	<atom:link href="http://www.developingasp.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.developingasp.net</link>
	<description>Random Ramblings On ASP.Net</description>
	<pubDate>Sun, 20 Jul 2008 05:04:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>RegisterClientScriptBlock Example</title>
		<link>http://www.developingasp.net/2008/07/registerclientscriptblock-example/</link>
		<comments>http://www.developingasp.net/2008/07/registerclientscriptblock-example/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 05:04:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[CSharp Commands]]></category>

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=16</guid>
		<description><![CDATA[Whiel using the AJAXToolkit i came up with the situation where i needed to run some javascript after a server-side event was called. After poking around for a bit i found the command &#8220;ScriptManager.RegisterClientScriptBlock&#8221;. This command sends back asynchronously javascript that will be executed by the clients browser on update. Here is an example:-

string strscript [...]]]></description>
			<content:encoded><![CDATA[<p>Whiel using the AJAXToolkit i came up with the situation where i needed to run some javascript after a server-side event was called. After poking around for a bit i found the command &#8220;ScriptManager.RegisterClientScriptBlock&#8221;. This command sends back asynchronously javascript that will be executed by the clients browser on update. Here is an example:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #FF0000;">string</span> strscript <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;var cbut=$get('programmaticPopup');alert(cbut.id+' '+cbut.style.position);&quot;</span><span style="color: #008000;">;</span>
ScriptManager.<span style="color: #0000FF;">RegisterClientScriptBlock</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Page</span>, <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #666666;">&quot;ToggleScript&quot;</span>, strscript, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>this.Page is your pages current Page object, &#8220;ToggleScript&#8221; is the name you are giving the script block, strscript is a string containg the javascript and following that is true which is there to tell the command to suround the inputed javascript with &#8220;<script></script>&#8221; </p>
<p>p.s. you will notice the javascript command $get(elementname), this returns the object with the ID you gave it at design time just like document.getElementById();. If you look at the source of a running script all the ID tags have strange strings appended to the start of the ID name you gave it. $get finds the element without all the crap. Its part of the AJAX Toolkit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/registerclientscriptblock-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Redimension An Array CSharp</title>
		<link>http://www.developingasp.net/2008/07/redimension-an-array-csharp/</link>
		<comments>http://www.developingasp.net/2008/07/redimension-an-array-csharp/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 04:45:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CSharp Commands]]></category>

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=15</guid>
		<description><![CDATA[Here is a function to redimension an array in csharp:-

private static void ReDim&#40;ref TextBox&#91;&#93; arr, int length&#41;
    &#123;
        try
        &#123;
            if &#40;arr == null&#41;
    [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a function to redimension an array in csharp:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> ReDim<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ref</span> TextBox<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> arr, <span style="color: #FF0000;">int</span> length<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">try</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>arr <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                arr <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TextBox<span style="color: #000000;">&#91;</span>length<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>arr.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">!=</span> length<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    TextBox<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> arrTemp <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TextBox<span style="color: #000000;">&#91;</span>length<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
                    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>length <span style="color: #008000;">&gt;</span> arr.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span>
                    <span style="color: #000000;">&#123;</span>
                        Array.<span style="color: #0000FF;">Copy</span><span style="color: #000000;">&#40;</span>arr, <span style="color: #FF0000;">0</span>, arrTemp, <span style="color: #FF0000;">0</span>, arr.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        arr <span style="color: #008000;">=</span> arrTemp<span style="color: #008000;">;</span>
                    <span style="color: #000000;">&#125;</span>
                    <span style="color: #0600FF;">else</span>
                    <span style="color: #000000;">&#123;</span>
                        Array.<span style="color: #0000FF;">Copy</span><span style="color: #000000;">&#40;</span>arr, <span style="color: #FF0000;">0</span>, arrTemp, <span style="color: #FF0000;">0</span>, length<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        arr <span style="color: #008000;">=</span> arrTemp<span style="color: #008000;">;</span>
                    <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception ex<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">string</span> x <span style="color: #008000;">=</span> ex.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//Console.WriteLine(x);</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>This example is for a string array but you can overload it with whatever type you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/redimension-an-array-csharp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>isNumeric String Checker</title>
		<link>http://www.developingasp.net/2008/07/isnumeric-string-checker/</link>
		<comments>http://www.developingasp.net/2008/07/isnumeric-string-checker/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 04:41:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CSharp Commands]]></category>

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

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=14</guid>
		<description><![CDATA[Here is a way to check if a string is a number:-

public static bool isNumeric&#40;string val, System.Globalization.NumberStyles NumberStyle&#41;
    &#123;
        Double result;
        return Double.TryParse&#40;val, NumberStyle, System.Globalization.CultureInfo.CurrentCulture, out result&#41;;
    &#125;

Here is a link so you can figure [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a way to check if a string is a number:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">bool</span> isNumeric<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> val, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Globalization</span>.<span style="color: #0000FF;">NumberStyles</span> NumberStyle<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #FF0000;">Double</span> result<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> <span style="color: #FF0000;">Double</span>.<span style="color: #0000FF;">TryParse</span><span style="color: #000000;">&#40;</span>val, NumberStyle, <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Globalization</span>.<span style="color: #0000FF;">CultureInfo</span>.<span style="color: #0000FF;">CurrentCulture</span>, <span style="color: #0600FF;">out</span> result<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Here is a link so you can figure out what to put in the &#8220;NumberStyle&#8221; field.<br />
<a href="http://msdn.microsoft.com/en-us/library/system.globalization.numberstyles.aspx" onclick="javascript:pageTracker._trackPageview ('/outbound/msdn.microsoft.com');">http://msdn.microsoft.com/en-us/library/system.globalization.numberstyles.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/isnumeric-string-checker/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Changing the MasterPageFile Dynamically</title>
		<link>http://www.developingasp.net/2008/07/changing-the-masterpagefile-dynamically/</link>
		<comments>http://www.developingasp.net/2008/07/changing-the-masterpagefile-dynamically/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 04:28:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CSharp Commands]]></category>

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

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=13</guid>
		<description><![CDATA[In a project i had been working on i wanted to have a central MasterPageFile that had variable sub MasterPageFile&#8217;s. I finally figured out that you have to override the &#8220;OnPreInit&#8221; Event on the page you wish to modify. Here is an example:-

protected override void OnPreInit&#40;EventArgs e&#41;
    &#123;
&#160;
     [...]]]></description>
			<content:encoded><![CDATA[<p>In a project i had been working on i wanted to have a central MasterPageFile that had variable sub MasterPageFile&#8217;s. I finally figured out that you have to override the &#8220;OnPreInit&#8221; Event on the page you wish to modify. Here is an example:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> OnPreInit<span style="color: #000000;">&#40;</span>EventArgs e<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
&nbsp;
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>Web_Security.<span style="color: #0000FF;">IsSU</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">MasterPageFile</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;~/management/SUMasterPage.master&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">else</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">MasterPageFile</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;~/management/MemberMasterPage.master&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">OnPreInit</span><span style="color: #000000;">&#40;</span>e<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Hope this saves you some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/changing-the-masterpagefile-dynamically/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Image Resize With CSharp</title>
		<link>http://www.developingasp.net/2008/07/image-resize-with-csharp/</link>
		<comments>http://www.developingasp.net/2008/07/image-resize-with-csharp/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 04:16:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Graphics]]></category>

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=12</guid>
		<description><![CDATA[Often it is necessary to resize an image that has been uploaded. To do this you will need the following using classes:-

using System.Drawing;
using System.Drawing.Imaging;

Then here are some examples on functions with the resize code:-

public static string ResizeImageAndSave&#40;int Width, int Height, string imageUrl,string destPath&#41;
	&#123;
&#160;
&#160;
        System.Drawing.Image fullSizeImg = System.Drawing.Image.FromFile&#40;HttpContext.Current.Server.MapPath&#40;imageUrl&#41;&#41;;
&#160;
  [...]]]></description>
			<content:encoded><![CDATA[<p>Often it is necessary to resize an image that has been uploaded. To do this you will need the following using classes:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Drawing</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Drawing.Imaging</span><span style="color: #008000;">;</span></pre></div></div>

<p>Then here are some examples on functions with the resize code:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> ResizeImageAndSave<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> Width, <span style="color: #FF0000;">int</span> Height, <span style="color: #FF0000;">string</span> imageUrl,<span style="color: #FF0000;">string</span> destPath<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
&nbsp;
&nbsp;
        <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Image</span> fullSizeImg <span style="color: #008000;">=</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Image</span>.<span style="color: #0000FF;">FromFile</span><span style="color: #000000;">&#40;</span>HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Server</span>.<span style="color: #0000FF;">MapPath</span><span style="color: #000000;">&#40;</span>imageUrl<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #FF0000;">double</span> widthRatio <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">double</span><span style="color: #000000;">&#41;</span>fullSizeImg.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">double</span><span style="color: #000000;">&#41;</span>Width<span style="color: #008000;">;</span>
        <span style="color: #FF0000;">double</span> heightRatio <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">double</span><span style="color: #000000;">&#41;</span>fullSizeImg.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">double</span><span style="color: #000000;">&#41;</span>Height<span style="color: #008000;">;</span>
        <span style="color: #FF0000;">double</span> ratio <span style="color: #008000;">=</span> Math.<span style="color: #0000FF;">Max</span><span style="color: #000000;">&#40;</span>widthRatio, heightRatio<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #FF0000;">int</span> newWidth <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>fullSizeImg.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">/</span> ratio<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #FF0000;">int</span> newHeight <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>fullSizeImg.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">/</span> ratio<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Image</span>.<span style="color: #0000FF;">GetThumbnailImageAbort</span> dummyCallBack <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Image</span>.<span style="color: #0000FF;">GetThumbnailImageAbort</span><span style="color: #000000;">&#40;</span>ThumbnailCallback<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Image</span> thumbNailImg <span style="color: #008000;">=</span> fullSizeImg.<span style="color: #0000FF;">GetThumbnailImage</span><span style="color: #000000;">&#40;</span>newWidth, newHeight,dummyCallBack, IntPtr.<span style="color: #0000FF;">Zero</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        DateTime MyDate <span style="color: #008000;">=</span> DateTime.<span style="color: #0000FF;">Now</span><span style="color: #008000;">;</span>
        <span style="color: #FF0000;">String</span> MyString <span style="color: #008000;">=</span> MyDate.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;ddMMyyhhmmss&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.png&quot;</span><span style="color: #008000;">;</span>
        thumbNailImg.<span style="color: #0000FF;">Save</span><span style="color: #000000;">&#40;</span>HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Server</span>.<span style="color: #0000FF;">MapPath</span><span style="color: #000000;">&#40;</span>destPath<span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> MyString, ImageFormat.<span style="color: #0000FF;">Png</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        thumbNailImg.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> MyString<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">bool</span> ThumbnailCallback<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/image-resize-with-csharp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>File.Delete Command</title>
		<link>http://www.developingasp.net/2008/07/filedelete-command/</link>
		<comments>http://www.developingasp.net/2008/07/filedelete-command/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 04:09:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CSharp Commands]]></category>

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=11</guid>
		<description><![CDATA[Here is an example on how to delete files in the file sytem:-

public static void DeleteFile&#40;string FilePath&#41;
    &#123;
        try
        &#123;
            FileInfo TheFile = new FileInfo&#40;HttpContext.Current.Server.MapPath&#40;FilePath&#41;&#41;;
   [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an example on how to delete files in the file sytem:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> DeleteFile<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> FilePath<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">try</span>
        <span style="color: #000000;">&#123;</span>
            FileInfo TheFile <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> FileInfo<span style="color: #000000;">&#40;</span>HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Server</span>.<span style="color: #0000FF;">MapPath</span><span style="color: #000000;">&#40;</span>FilePath<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>TheFile.<span style="color: #0000FF;">Exists</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                File.<span style="color: #0000FF;">Delete</span><span style="color: #000000;">&#40;</span>HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Server</span>.<span style="color: #0000FF;">MapPath</span><span style="color: #000000;">&#40;</span>FilePath<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> FileNotFoundException<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>FileNotFoundException e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            LogEntry log <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LogEntry<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">EventId</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">701</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Message</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Error Deleting File<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">+</span> FilePath <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">+</span> e.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">+</span> e.<span style="color: #0000FF;">StackTrace</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Categories</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;General&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Severity</span> <span style="color: #008000;">=</span> TraceEventType.<span style="color: #0000FF;">Information</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Priority</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">5</span><span style="color: #008000;">;</span>
            Logger.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>log<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            LogEntry log <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LogEntry<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">EventId</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1301</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Message</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Error Deleting File Exception<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">+</span> FilePath <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">+</span> e.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">+</span> e.<span style="color: #0000FF;">StackTrace</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Categories</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;General&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Severity</span> <span style="color: #008000;">=</span> TraceEventType.<span style="color: #0000FF;">Information</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Priority</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">5</span><span style="color: #008000;">;</span>
            Logger.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span>log<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>The example code above has some custom error exception handling that you may want to remove.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/filedelete-command/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Guest Speaker</title>
		<link>http://www.developingasp.net/2008/07/guest-speaker/</link>
		<comments>http://www.developingasp.net/2008/07/guest-speaker/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 19:33:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.developingasp.net/?p=10</guid>
		<description><![CDATA[when my erstwhile friend daniel first suggested that i should expatiate my views on the problems related with the evolving power of the computer and the concomitant ever increasing perception of the validity of it per se i thought that as a subject it w3aqs axiomatic as to answers that most reasonable people of a [...]]]></description>
			<content:encoded><![CDATA[<p>when my erstwhile friend daniel first suggested that i should expatiate my views on the problems related with the evolving power of the computer and the concomitant ever increasing perception of the validity of it per se i thought that as a subject it w3aqs axiomatic as to answers that most reasonable people of a generation several ages before my own wherethe computer and the internet were as essential to the survival of a free and law abiding peoples where the brave new world of a sophistecated elite versed in the unequivical necessity of the computer by and large were inept and afraid to face life seen as ultimately rewarding only if virtual reality were the abiding absolute.what a crock of shit i thought;they justify their claims because it as pervasive state of the art technology is here to stayand i may be dumb but im not stupid and it becomes an ineluctable fact that the purpose ofthe computer is to help an increasingly fragile enviroment with faster and more sophisticated means to substantiate an ever stumbling homo sapiens as he lurches like some out of step dipsomaniac more akin to schadenfreude as society invertes on itself as the only cogent means to survive a world where acceptanceof its downward spiral towards the proverbial armageddon and we must make the imperitive of the cosmological essence of mankindes very existence as an emerging type two civilisation make any such argument as mine as out of step with reality as it is as,das ding an sich things as they are in themselves but has it not already made itself redundant by inextricably stating any situation as becoming as important as breathing and that as analogous to cyberspace and stating that without the computer and the net we are doomed to mediocrity and despair unless we do harness the very thing that will separate us from atavism and anomilies in the very structure that propels us towards an increasingly fragile view of ourselves as some how in anthropological terms at least as progressing forward in a benign spiritual quest to see ourselves as a forlorn but essential element in the knowledge of god like control over the cosmos;but the essence of the spurious but de riguer containment of duty to lead our more older and less enlightened older citizens like moses leading the israelites out of servititude but what has humanity learned about its structure vis a vis the soul or spirit as viewed by the buddhists of the hinayanna sect who understands that man and only man can solve the problem of life as illusion;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/guest-speaker/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accessing Post Variables in C# ASP.Net</title>
		<link>http://www.developingasp.net/2008/07/accessing-post-variables-in-c-aspnet/</link>
		<comments>http://www.developingasp.net/2008/07/accessing-post-variables-in-c-aspnet/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 17:47:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

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

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

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=9</guid>
		<description><![CDATA[I was writing dynamic form variables to the page and i needed to retrieve their values when updated. When i tried to access the variables with request.params[] collection i noticed that the keys were what id i had given them with a string appended to the start. I wrote this function to easiliy access the [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing dynamic form variables to the page and i needed to retrieve their values when updated. When i tried to access the variables with request.params[] collection i noticed that the keys were what id i had given them with a string appended to the start. I wrote this function to easiliy access the variables:-</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> PostVal<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> key<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #FF0000;">string</span> retval <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> s <span style="color: #0600FF;">in</span> HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span>.<span style="color: #0000FF;">AllKeys</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> sr <span style="color: #008000;">=</span> s.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">'$'</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>sr<span style="color: #000000;">&#91;</span>sr.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> key<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                retval <span style="color: #008000;">=</span> HttpContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span>s<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">return</span> retval<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/accessing-post-variables-in-c-aspnet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Colour Picker</title>
		<link>http://www.developingasp.net/2008/07/colour-picker/</link>
		<comments>http://www.developingasp.net/2008/07/colour-picker/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 00:38:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[User Interface]]></category>

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

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=8</guid>
		<description><![CDATA[I needed to have custom colours in my project so i looked at a few controls out there and the one i chose is from http://www.obout.com/ It seemed to do the job quite nicely.
]]></description>
			<content:encoded><![CDATA[<p>I needed to have custom colours in my project so i looked at a few controls out there and the one i chose is from http://www.obout.com/ It seemed to do the job quite nicely.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/colour-picker/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Writing Dynamically To The Page</title>
		<link>http://www.developingasp.net/2008/07/writing-dynamically-to-the-page/</link>
		<comments>http://www.developingasp.net/2008/07/writing-dynamically-to-the-page/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 10:12:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[User Interface]]></category>

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

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

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

		<guid isPermaLink="false">http://www.developingasp.net/?p=6</guid>
		<description><![CDATA[I was making a yearly calendar and i needed to output the cells to represent the days in the year. At first i just made a public variable, filled it up with html and then outputed it to the page like this:-

1
&#60;%=variablename%&#62;

This seemed to work well but the page didn&#8217;t update on postback methods because [...]]]></description>
			<content:encoded><![CDATA[<p>I was making a yearly calendar and i needed to output the cells to represent the days in the year. At first i just made a public variable, filled it up with html and then outputed it to the page like this:-</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="csharp"><span style="color: #008000;">&lt;%=</span>variablename<span style="color: #008000;">%&gt;</span></pre></td></tr></table></div>

<p>This seemed to work well but the page didn&#8217;t update on postback methods because the html was being rendered before any methods were executing.<br />
I figured there must be a way to output to the current page so i had a look around and found some code that updated a panel control. To send it raw html use this command:-</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="csharp">panMainCalendar.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> LiteralControl<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;&lt;tr&gt;&lt;td height='20'&gt;&lt;div align='left'&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>To add a control try this:-</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="csharp">Button NLab <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Button<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
Unit NU <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Unit<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">100</span>,UnitType.<span style="color: #0000FF;">Percentage</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
NLab.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">=</span> NU<span style="color: #008000;">;</span>
NLab.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">=</span> NU<span style="color: #008000;">;</span>
NLab.<span style="color: #0000FF;">Click</span> <span style="color: #008000;">+=</span> Day_Click<span style="color: #008000;">;</span>
NLab.<span style="color: #0000FF;">CssClass</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;ButtonCell&quot;</span><span style="color: #008000;">;</span>
NLab.<span style="color: #0000FF;">ID</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;lbCell_&quot;</span><span style="color: #008000;">+</span>Day <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;_&quot;</span> <span style="color: #008000;">+</span> Month <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;_&quot;</span> <span style="color: #008000;">+</span> Year<span style="color: #008000;">;</span>
panMainCalendar.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>NLab<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Good Luck</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developingasp.net/2008/07/writing-dynamically-to-the-page/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
