<?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>Code Den</title>
	<atom:link href="http://lionsden.co.il/codeden/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://lionsden.co.il/codeden</link>
	<description>.NET and JavaScript Examples, Solutions, Tips and Tricks</description>
	<lastBuildDate>Tue, 18 May 2010 13:20:46 +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>IIS7.5 &#8220;HTTP Error 500.19 – Internal Server Error&#8221;</title>
		<link>http://lionsden.co.il/codeden/?p=466</link>
		<comments>http://lionsden.co.il/codeden/?p=466#comments</comments>
		<pubDate>Sun, 18 Apr 2010 20:33:30 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[IIS7]]></category>
		<category><![CDATA[500.19]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[URL Rewrite]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=466</guid>
		<description><![CDATA[The symptom The search for a cause and a solution The actual cause and soluion The symptom After loading an ASP.NET web application on an IIS7.5 server, navigating to the site resulting in the following error: The search for a cause and a solution The first step was this Microsoft KB Article that breaks down [...]]]></description>
			<content:encoded><![CDATA[<ul>
<a href="#Symptom">The symptom</a><br />
<a href="#Search">The search for a cause and a solution</a><br />
<a href="#Solution">The actual cause and soluion</a>
</ul>
<p><a id="Symptom" /><br />
<h4>The symptom</h4>
<p>After loading an ASP.NET web application on an IIS7.5 server, navigating to the site resulting in the following error:</p>
<p><a href="http://lionsden.co.il/codeden/wp-content/uploads/2010/03/500-19.jpg" target="_blank"><img src="http://lionsden.co.il/codeden/wp-content/uploads/2010/03/500-19-300x136.jpg" alt="HTTP Error 500.19 - Internal Server Error" title="HTTP Error 500.19" width="300" height="136" class="aligncenter size-medium wp-image-467" /></a></p>
<p><a id="Search" /><br />
<h4>The search for a cause and a solution</h4>
<p>The first step was this Microsoft KB Article that breaks down the 500.19 error based on the HResult: <a href='http://support.microsoft.com/kb/942055' target='_blank'>http://support.microsoft.com/kb/942055</a>. Unfortunately, for the HResult above, 0x8007000d, the only cause listed is &#8220;a malformed XML elemen&#8221; in the web.config. After spending some time looking at the web.config I came to the conclusion there were no malformed tags.</p>
<p>The next solution I found was from JohnnyW on ASP.NET, <a href='http://forums.asp.net/p/1497910/3536801.aspx#3536801' target='_blank'>http://forums.asp.net/p/1497910/3536801.aspx#3536801</a>. JohnnyW&#8217;s error was evidently caused by Ajax not being properly installed. He includes this link on how to configure AJAX for ASP.NET. Since, due to some old controls we do require the AJAX 1.0 extensions to be installed I made the changes to the web.config it recommends, but still kept getting the same error.</p>
<p>I decided to manually hunt for the cause in the web.config and so I started to remove sections one at a time until the error disapeared and the site loaded.</p>
<p><a id="Solution" /><br />
<h4>The actual cause and soluion</h4>
<p>The section that was actually causing the error was the rewrite section.</p>

<div class="wp_codebox"><table><tr id="p4662"><td class="code" id="p466code2"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Redirect to www&quot;</span> <span style="color: #000066;">stopProcessing</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;.*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;conditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">input</span>=<span style="color: #ff0000;">&quot;{HTTP_HOST}&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;^www.mySite.com$&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">input</span>=<span style="color: #ff0000;">&quot;{HTTP_HOST}&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;^mySite.com$&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">input</span>=<span style="color: #ff0000;">&quot;{HTTP_HOST}&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;^mySite.com$&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/conditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;Redirect&quot;</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;http://www.my_Site.com/{R:0}&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">redirectType</span>=<span style="color: #ff0000;">&quot;Permanent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rewrite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Searching for information on redirect rules led me to <a href='http://geekswithblogs.net/kit/archive/2009/04/19/131291.aspx' target='_blank'>http://geekswithblogs.net/kit/archive/2009/04/19/131291.aspx</a>, where he explains you can use URL Rewrite &#8220;by installing the URL Rewrite Module.&#8221; This was what actually caused the 500.19 error. The server didn&#8217;t have the url rewrite module installed. I solved the issue by downloading the IIS URL Rewrite 2.0 from here: <a href='http://www.iis.net/download/URLRewrite'>http://www.iis.net/download/URLRewrite</a> and installing it. Instantly the 500.19 error was cleared up.</p>
]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=466</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS7 Sessions Getting Crossed / Mixed Up / Copied</title>
		<link>http://lionsden.co.il/codeden/?p=446</link>
		<comments>http://lionsden.co.il/codeden/?p=446#comments</comments>
		<pubDate>Wed, 17 Feb 2010 20:25:46 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Sessions]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=446</guid>
		<description><![CDATA[The symptom What it was not What it was The solution The symptom Users reported seeing data that did not belong to them when they logged into their accounts. Logs showed that nearly 10% of our users were being assigned copies of other users’ sessions. The entire session object was copied, including the sessionVariables and [...]]]></description>
			<content:encoded><![CDATA[<ul>
<a href="#Symptom">The symptom</a><br />
<a href="#WhatNot">What it was not</a><br />
<a href="#WhatWas">What it was</a><br />
<a href="#Solution">The solution</a>
</ul>
<p><a id="Symptom" /><br />
<h4>The symptom</h4>
<p>Users reported seeing data that did not belong to them when they logged into their accounts. Logs showed that nearly 10% of our users were being assigned copies of other users’ sessions. The entire session object was copied, including the sessionVariables and sessionID. Once duplicated the individual sessions could be modified without affecting the other (i.e. abandoning one did not kill the other).</p>
<p>To spot instances of the problem I stored the Request.RemoteHost (The IP address of the computer making the request) in a sessionVariable. At the beginning of each request I checked to make sure the session’s IP matched the current request’s IP. </p>
<p><a id="WhatNot" /><br />
<h4>What is was not</h4>
<p>It is possible that the IP would change naturally, most simply if a user reset his router/modem. This was not the case because it was happening way too often. Further, there were confirmed instances of one user’s data being crossed with another’s.  Finally, some of the pairs of IPs weren’t just on different computer, but were in different countries.</p>
<p>It is also possible, and was often suggested, that sessionVariables can stop being unique if they are used with static/shared variables within the WebApp. This was not the case either, because the IP address I stored in the session was only written to once, from the request and afterwards was only read to compare back to the request. This was also ruled out because the SessionID was also duplicated and that is a read only value.</p>
<p><a id="WhatWas" /><br />
<h4>What is was</h4>
<p>It is a feature/bug in IIS7. This latest version of IIS introduced some new caching features.</p>
<ol>
<li>IIS7 automatically caches static content, such as HTML pages, images, and style sheets.</li>
<li>IIS7 now has the ability to cache dynamic content as well.</li>
</ol>
<p>Caching dynamic content is great if it is a page such as a dynamically generated image gallery, or a page that is generated dynamically based on the browser’s culture. However, in this thread, <a href="http://forums.iis.net/t/1154347.aspx?PageIndex=2" target="_blank">http://forums.iis.net/t/1154347.aspx?PageIndex=2</a>, Anil Ruia, a Senior Software Design Engineer on the IIS Core, explains, “You should not be enabling output caching for any response which depends on session state.” </p>
<p>If the page generating the content depends on the session state, it caches the session object along with the rest of the page. The next user to come through ends up pulling the cached session, instead of getting a new one. When I checked our settings I found it was set to cache all .aspx pages for three minutes, including many pages that access the session.</p>
<p><a id="Solution" /><br />
<h4>The solution</h4>
<p><a href="http://lionsden.co.il/codeden/wp-content/uploads/2010/02/cache.jpg" target="_blank"><img src="http://lionsden.co.il/codeden/wp-content/uploads/2010/02/cache-262x300.jpg" alt="Edit Cache Rule" title="Edit Cache Rule" width="262" height="300" class="alignright size-medium wp-image-452" style="margin-left:5px;" /></a></p>
<p>In IIS7, disable the caching for .aspx pages in any directory with an asp.net page that depends on the session state. To do this:</p>
<ol>
<li>Run the Server Management console.</li>
<li>Navigate to Roles -> Web Server (IIS) -> Internet Information Services.</li>
<li>Select the site you wish to modify.</li>
<li>Select the folder that contains the .aspx pages you need to turn caching off for.</li>
<li>In the Feature View, double-click “Output Caching”.</li>
<li>If there is a rule there already for the .aspx extension double click it. Otherwise right click and select &#8220;Add&#8230;&#8221;</li>
<li>Enter .aspx for the &#8220;File name extension&#8221;</li>
<li>Check “User-mode caching”</li>
<li>Select “Prevent all caching”</li>
<li>Check “Kernel-mode caching”</li>
<li>Select “Prevent all caching”</li>
<li>Click OK</li>
<li>Close the Server management Console</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=446</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why the scrollbar won&#8217;t show on the left in Firefox</title>
		<link>http://lionsden.co.il/codeden/?p=440</link>
		<comments>http://lionsden.co.il/codeden/?p=440#comments</comments>
		<pubDate>Mon, 26 Oct 2009 17:56:11 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[ltr]]></category>
		<category><![CDATA[rtl]]></category>
		<category><![CDATA[scrollbar]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=440</guid>
		<description><![CDATA[The Scenario When designing a website for a right to left (RTL) language the scrollbar should automatically be on the left hand side. The logic is that it should be at the end of the line, just as it is on the right for a left to right (LTR) language. This works fine in IE, [...]]]></description>
			<content:encoded><![CDATA[<h4>The Scenario</h4>
<p>When designing a website for a right to left (RTL) language the scrollbar should automatically be on the left hand side. The logic is that it should be at the end of the line, just as it is on the right for a left to right (LTR) language. This works fine in IE, but Firefox will always show the scrollbar on the right.</p>
<h4>The Cause</h4>
<p>Unfortunately this is by design. Firefox believes that the scrollbar is part of the browser, not the webpage and so by default a website should not have the ability to override the user&#8217;s settings. IE believes the scrollbar is not part of the browser but part of the page. Therefore, if a page is RTL the scrollbar should be on the left.</p>
<h4>The Solution</h4>
<p>This can be fixed on an individual instance of Firefox.</p>
<ol>
<li>Open Firefox</li>
<li>Navigate to about:config</li>
<li>Set the filter to layout.scrollbar.side</li>
<li>Double click the layout.scrollbar.side line</li>
<li>Change the setting to 1 and click OK</li>
</ol>
<p>Now Firefox will behave like IE and show the scrollbar on which ever side the page dictates. Unfortunately, this will not help any of your users. The best solution to assure your RTL website displays the scrollbar on the correct side is to use a third party customizable scrollbar, such as <a href="http://www.willjessup.com/sandbox/jquery/scrollbar/scrollbar.html">jQuery Scrollbar</a> or <a href="http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html">jScrollPane</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=440</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WUMP &#8211; Website Uptime Monitor Program</title>
		<link>http://lionsden.co.il/codeden/?p=415</link>
		<comments>http://lionsden.co.il/codeden/?p=415#comments</comments>
		<pubDate>Sat, 10 Oct 2009 23:17:58 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=415</guid>
		<description><![CDATA[Click here: http://wump.codeplex.com/Wiki/View.aspx?title=Home&#038;ProjectName=wump to download the WUMP from its CodePlex page. What is WUMP? After a frantic call from a client who found her site was down due to a server issue, I decided I needed a way to regularly monitor the sites I consult for. WUMP, the Website Uptime Monitor Program, is the resulting [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<div style="width:590px; padding:10px 3px 10px 3px; border-style:solid; border-width:1px; border-color:gray; text-align:center;">
                Click here: <a href='http://wump.codeplex.com/Wiki/View.aspx?title=Home&#038;ProjectName=wump'>http://wump.codeplex.com/Wiki/View.aspx?title=Home&#038;ProjectName=wump</a> to download the WUMP from its CodePlex page.
            </div>
<p><img src="http://lionsden.co.il/codeden/wp-content/uploads/2009/10/wump_settings.jpg" alt="WUMP Settings" title="WUMP Settings" width="303" height="456" style="float:right;"  hspace="5" /></p>
<h3>What is WUMP?</h3>
<p>After a frantic call from a client who found her site was down due to a server issue, I decided I needed a way to regularly monitor the sites I consult for. WUMP, the Website Uptime Monitor Program, is the resulting solution. Written in C# 2008, WUMP is made up of three projects.</p>
<ol>
<li><strong>AutoWump</strong> &#8211; A windows service to control the automated WUMPing, or testing, of sites</li>
<li><strong>SledgeHammer</strong> &#8211; A class library that does the actual work</li>
<li><strong>wump</strong> &#8211; A Windows application for customizing the settings, starting and stopping the AutoWump, and running manual tests.</li>
</ol>
<h4>Features:</h4>
<ul>
<li>Automatically monitor the status of multiple websites at a set interval</li>
<li>Manually check the status of multiple websites </li>
<li>Test site statuses without affecting Google Analytics </li>
<li>Maintain a log of test results </li>
<li>Send an email alert if a test fails</li>
</ul>
<h4>How WUMP works:</h4>
<p>In order to test the site without affecting the Google Analytics add a file to the root path of the site. The name of the file is configurable. By default it should be named &#8220;wump.html&#8221;. The file can simply be an empty page:</p>

<div class="wp_codebox"><table><tr id="p4154"><td class="code" id="p415code4"><pre class="html" style="font-family:monospace;">&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;WUMP&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>When a site is WUMPed, the program attempts to download the target file. If it encounters an error the test fails. A log is kept of all test results in a text file, by default &#8220;c:\wump.log&#8221;. In the event of a failed test result WUMP has the ability to send an email via SMTP.</p>
<h4>Where to get WUMP:</h4>
<p>WUMP is available as an open source project on CodePlex here: <a href='http://wump.codeplex.com/Wiki/View.aspx?title=Home&#038;ProjectName=wump'>http://wump.codeplex.com/Wiki/View.aspx?title=Home&#038;ProjectName=wump</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=415</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CalendarExtender Plus 1.0.2.0</title>
		<link>http://lionsden.co.il/codeden/?p=367</link>
		<comments>http://lionsden.co.il/codeden/?p=367#comments</comments>
		<pubDate>Thu, 10 Sep 2009 19:51:00 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax Control Toolkit]]></category>
		<category><![CDATA[.NET 3.5]]></category>
		<category><![CDATA[3.0.30512]]></category>
		<category><![CDATA[CalendarExtender]]></category>
		<category><![CDATA[Date Range]]></category>
		<category><![CDATA[User Control]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=367</guid>
		<description><![CDATA[to download the latest version of CalendarExtender Plus and documentation. The CalendarExtender Plus is a modification of the calendar extender that ships as part of the Ajax Control Toolkit. There are two main features added to the control. First, you can limit the selectable dates to a specified date range. Second, there is now the [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<div style="width:590px; padding:10px 3px 10px 3px; border-style:solid; border-width:1px; border-color:gray; ">
                <a href="http://lionsden.co.il/codeden/wp-content/plugins/download-monitor/download.php?id=CalendarExtenderPlus_1.0.2.0.zip" title="Download this solution">Click Here</a> to download the latest version of CalendarExtender Plus and documentation.
            </div>
<p>The <strong>CalendarExtender Plus</strong> is a modification of the calendar extender that ships as part of the Ajax Control Toolkit. There are two main features added to the control. First, you can limit the selectable dates to a specified date range. Second, there is now the option to show an alternate header. The new header includes two DropDown Lists, one to select the month and one to select the year.</p>
<p><span id="more-367"></span></p>
<table width="100%">
<tr>
<td>
<h4>CalendarExtender Plus 1.0.2.0 &#8211; New Properties</h4>
<p>By default the work week is from Monday to Friday. The two new properties, WorkWeekFirstDay and WorkWeekLastDay, can be used to change this. With the differentiation between work week and weekend, the properties EnableWorkDays and EnableWeekendDays will enable or disable their respective days.</p>

<div class="wp_codebox"><table><tr id="p3678"><td class="code" id="p367code8"><pre class="html" style="font-family:monospace;">&lt;cc1:CalendarExtenderPlus runat=&quot;server&quot; ID=&quot;ceExample&quot; 
    TargetControlID=&quot;txtDate&quot; ShowDdlHeader=&quot;true&quot; 
    EnableWeekendDays=&quot;false&quot; /&gt;</pre></td></tr></table></div>

</td>
<td>
            <img src="http://lionsden.co.il/codeden/wp-content/uploads/2009/09/weekend_disabled.gif" alt="Weekend Disabled" title="Weekend Disabled" width="180" height="190" class="size-full wp-image-371" />
        </td>
</tr>
</table>
<h4>CalendarExtender Plus 1.0.2.0 &#8211; New Default css</h4>
<p>As recommended by Christian von Krogh, disabled dates are now grayed out by default. The new default css classes that control this are below. To hide the inactive dates completely change the color attribute to the same value as the background-color attribute.</p>

<div class="wp_codebox"><table><tr id="p3679"><td class="code" id="p367code9"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.ajax__calendar</span> <span style="color: #6666ff;">.ajax__calendar_other</span> .ajax__calendar_day 
    <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#dbdbdb</span><span style="color: #00AA00;">;</span>cursor<span style="color: #00AA00;">:</span><span style="color: #993333;">default</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.ajax__calendar</span> <span style="color: #6666ff;">.ajax__calendar_other</span> .ajax__calendar_month 
    <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#dbdbdb</span><span style="color: #00AA00;">;</span>cursor<span style="color: #00AA00;">:</span><span style="color: #993333;">default</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.ajax__calendar</span> <span style="color: #6666ff;">.ajax__calendar_other</span> .ajax__calendar_year 
    <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#dbdbdb</span><span style="color: #00AA00;">;</span>cursor<span style="color: #00AA00;">:</span><span style="color: #993333;">default</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h4>CalendarExtender Plus 1.0.2.0 &#8211; Bug Fix</h4>
<p>This version fixes the problem of the CalendarExtender Plus showing an error when viewing the page in design mode.</p>
<p>Just as the previous verison, CalendarExtender Plus is free to download, use, and distribute with your project. Any feedback is greatly appreciated!</p>
<h4>Using CalendarExtender Plus 1.0.2.0</h4>
<p>In order to add the CalendarExtender Plus to your page, you must first take these steps:</p>
<ol>
<li>Drag the .dll file to your application’s “bin” directory and make sure you have a reference to it in your project.</li>
<li>Include the following at the top of your page:</li>

<div class="wp_codebox"><table><tr id="p36710"><td class="code" id="p367code10"><pre class="html" style="font-family:monospace;">&lt;%@ Register Assembly=”CalendarExtenderPlus” Namespace=”AjaxControlToolkitPlus”
    TagPrefix=”cc1″ %&gt;</pre></td></tr></table></div>

</ol>
<p>Thank you Marc K for pointing out I forgot to include these instructions and posting them in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=367</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Show a Wait Message While Waiting for Postback to Complete</title>
		<link>http://lionsden.co.il/codeden/?p=345</link>
		<comments>http://lionsden.co.il/codeden/?p=345#comments</comments>
		<pubDate>Tue, 25 Aug 2009 08:13:53 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Client Side]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[UpdatePanel]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=345</guid>
		<description><![CDATA[Scenario Among the controls on a page is an update panel with a button that when clicked causes a partial postback that takes at least a few seconds. During this time you want to show the user a wait message that will disappear as soon as the postBack completes. Solution]]></description>
			<content:encoded><![CDATA[<h4>Scenario</h4>
<p>Among the controls on a page is an update panel with a button that when clicked causes a partial postback that takes at least a few seconds. During this time you want to show the user a wait message that will disappear as soon as the postBack completes.</p>
<p><span id="more-345"></span></p>
<h4>Solution</h4>
<table style=width:90%;" align="center">
<tr>
<td align="center">
<div style="width:280px; padding:3px 3px 3px 3px; border-style:solid; border-width:1px; border-color:gray;">
    <a href="http://lionsden.co.il/codeden/wp-content/plugins/download-monitor/download.php?id=PostBackWait.zip" title="Download this solution">Click Here</a> to download this solution
</div>
</td>
</tr>
</table>
<p>There are two steps to this. The first is to show the message via JavaScript before the postBack begins and the second is to remove it at the end of the postBack in the codeBehind. This example involves redirecting an iFrame to display the wait message and then redirecting it again to show some search results. The same technique can be used to change any property of any control, such as the text of a label or the visibility of an image.</p>
<h5>Step 1 &#8211; Client Side</h5>
<p>Declare a JavaScript function to redirect the iFrame.</p>

<div class="wp_codebox"><table><tr id="p34514"><td class="code" id="p345code14"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> loadIframe<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> objIfLoading <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ifResults'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    objIfLoading.<span style="color: #660066;">attributes</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'src'</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'Loading.aspx'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Place the button and the iFrame in an update panel. Make sure the iFrame has the runat=&#8221;server&#8221; tag and src=&#8221;". If the src is not set it will not run properly the first time the button is clicked in FireFox. Include in the search button&#8217;s declaration the OnClientClick attribute to call a JavaScript function.</p>

<div class="wp_codebox"><table><tr id="p34515"><td class="code" id="p345code15"><pre class="html" style="font-family:monospace;">&lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;upExample&quot;&gt;
   &lt;ContentTemplate&gt;
      &lt;asp:Button runat=&quot;server&quot; ID=&quot;btnSearch&quot; Text=&quot;Search&quot; 
         OnClientClick=&quot;loadIframe()&quot; OnClick=&quot;btnSearch_Click&quot; /&gt;
      &lt;br /&gt;
      &lt;iframe runat=&quot;server&quot; id=&quot;ifResults&quot; src=&quot;&quot;
         width=&quot;800px&quot; height=&quot;600px&quot; frameborder=&quot;0&quot;&gt;
      &lt;/iframe&gt;
    &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;</pre></td></tr></table></div>

<h5>Step 2 &#8211; Server Side</h5>
<p>Redirect the iFrame in the codeBehind after the search button has finished its work. To simulate the length of time it would take to find the search results I&#8217;ve added a sleep command.</p>

<div class="wp_codebox"><table><tr id="p34516"><td class="code" id="p345code16"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> btnSearch_Click <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #000000;">System.<span style="color: #0000FF;">Threading</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Thread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">3000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    ifResults<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;src&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;LoadFinished.aspx&quot;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=345</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default a TabContainer to No Tabs Selected</title>
		<link>http://lionsden.co.il/codeden/?p=337</link>
		<comments>http://lionsden.co.il/codeden/?p=337#comments</comments>
		<pubDate>Wed, 12 Aug 2009 11:49:29 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax Control Toolkit]]></category>
		<category><![CDATA[Client Side]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PageLoad]]></category>
		<category><![CDATA[TabContainer]]></category>
		<category><![CDATA[TabPanel]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=337</guid>
		<description><![CDATA[Question Under normal circumstances when a page loads with a tabContainer on it one tab must be selected. The selected tab can be specified via the ActiveTabIndex property. What if the tabContainer needs to default to an empty tab with none of the tabs selected? Solution Add a dummy tabPanel to the tabContainer and leave [...]]]></description>
			<content:encoded><![CDATA[<h4>Question</h4>
<p>Under normal circumstances when a page loads with a tabContainer on it one tab must be selected. The selected tab can be specified via the ActiveTabIndex property. What if the tabContainer needs to default to an empty tab with none of the tabs selected?</p>
<h4>Solution</h4>
<p>Add a dummy tabPanel to the tabContainer and leave it blank. Use the pageLoad JavaScript function to hide the tab&#8217;s header</p>

<div class="wp_codebox"><table><tr id="p33719"><td class="code" id="p337code19"><pre class="html" style="font-family:monospace;">&lt;cc1:TabContainer ID=&quot;TabContainer1&quot; runat=&quot;server&quot; 
    Height=&quot;200px&quot; Width=&quot;200px&quot; ActiveTabIndex=&quot;0&quot;&gt;
    &lt;cc1:TabPanel runat=&quot;server&quot; ID=&quot;tpDummy&quot; HeaderText=&quot;&quot;&gt;
        &lt;ContentTemplate&gt;
        &lt;/ContentTemplate&gt;
    &lt;/cc1:TabPanel&gt;
    &lt;cc1:TabPanel runat=&quot;server&quot; ID=&quot;tpName&quot; HeaderText=&quot;Name&quot;&gt;
        &lt;ContentTemplate&gt;
            Name:
            &lt;asp:TextBox runat=&quot;server&quot; ID=&quot;txtName&quot; /&gt;
        &lt;/ContentTemplate&gt;
    &lt;/cc1:TabPanel&gt;
    &lt;cc1:TabPanel runat=&quot;server&quot; ID=&quot;tpEmail&quot; HeaderText=&quot;Email&quot;&gt;
        &lt;ContentTemplate&gt;
            Email:
            &lt;asp:TextBox runat=&quot;server&quot; ID=&quot;txtEmail&quot; /&gt;
        &lt;/ContentTemplate&gt;
    &lt;/cc1:TabPanel&gt;
&lt;/cc1:TabContainer&gt;</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p33720"><td class="code" id="p337code20"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> pageLoad<span style="color: #009900;">&#40;</span>sender<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> objTpDummy <span style="color: #339933;">=</span> 
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;%= tpDummy.ClientID %&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'_tab'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    objTpDummy.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=337</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show a Wait Message While Generating a File for Download</title>
		<link>http://lionsden.co.il/codeden/?p=321</link>
		<comments>http://lionsden.co.il/codeden/?p=321#comments</comments>
		<pubDate>Mon, 10 Aug 2009 11:31:11 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=321</guid>
		<description><![CDATA[Scenario A page has a list of images for the user to choose from. When a file is selected the request is processed via an AJAX call that directs the source of an iFrame to another page where the image is generated and passed back to the client. Due to the size of some of [...]]]></description>
			<content:encoded><![CDATA[<h4>Scenario</h4>
<p>A page has a list of images for the user to choose from. When a file is selected the request is processed via an AJAX call that directs the source of an iFrame to another page where the image is generated and passed back to the client.</p>
<p>Due to the size of some of the images, the generation can take a noticeable amount of time. To make sure the user does not think the site is frozen a wait message is needed. Since the generating page only returns the image, we need another way to notify the client when the file is generated and the wait message can be hidden.</p>
<p><span id="more-321"></span></p>
<h4>Solution</h4>
<table style=width:90%;" align="center">
<tr>
<td align="center">
<div style="width:280px; padding:3px 3px 3px 3px; border-style:solid; border-width:1px; border-color:gray;">
    <a href="http://lionsden.co.il/codeden/wp-content/plugins/download-monitor/download.php?id=generatingnotification.zip" title="Download this solution">Click Here</a> to download this solution
</div>
</td>
</tr>
</table>
<p>This can be accomplished using a session variable and a timer to keep track of the generated file&#8217;s status. In this example the first updatePanel holds a button to start the file download, a label that will be used for the wait message, and the timer. The iFrame is in a second panel, separate from the timer, so it does not reload every time the timer ticks.</p>

<div class="wp_codebox"><table><tr id="p32125"><td class="code" id="p321code25"><pre class="html" style="font-family:monospace;">&lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;upDownload&quot;&gt;
    &lt;ContentTemplate&gt;
&nbsp;
        &lt;asp:Button runat=&quot;server&quot; ID=&quot;btnDownload&quot; 
            Text=&quot;Generate Image&quot; OnClick=&quot;btnDownload_Click&quot; /&gt;
&nbsp;
        &lt;%--This labeled is used as the notification that the 
            file is being generated. Until it is needed, the 
            display is set to none--%&gt;
        &lt;asp:Label runat=&quot;server&quot; ID=&quot;lblNotification&quot; 
            Text=&quot;Downloading... Please Wait&quot; Style=&quot;display: none;&quot; /&gt;
&nbsp;
        &lt;%--The timer starts off as disabled and will be enabled when 
             the user clicks the above button--%&gt;
        &lt;asp:Timer runat=&quot;server&quot; ID=&quot;tmrIndicator&quot; Interval=&quot;1000&quot; 
            OnTick=&quot;tmrIndicator_Tick&quot; Enabled=&quot;false&quot; /&gt;
&nbsp;
    &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;
&nbsp;
&lt;%--The iFrame is kept in a seperate update panel so it is not reloaded 
    every time the timer ticks--%&gt;
&lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;upFileGenerate&quot; 
     UpdateMode=&quot;Conditional&quot;&gt;
    &lt;Triggers&gt;
        &lt;asp:AsyncPostBackTrigger ControlID=&quot;btnDownload&quot; /&gt;
    &lt;/Triggers&gt;
    &lt;ContentTemplate&gt;
        &lt;iframe runat=&quot;server&quot; id=&quot;ifrGeneratedFile&quot; src=&quot;about:blank&quot; 
            width=&quot;0&quot; height=&quot;0&quot; /&gt;
    &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;</pre></td></tr></table></div>

<p>When the button is clicked, in addition to directing the iFrame to the new source, three things must be done. First, raise the flag indicating the file is being generated. Second, show the wait message. Third, enable the timer.</p>

<div class="wp_codebox"><table><tr id="p32126"><td class="code" id="p321code26"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> btnDownload_Click <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">//raise the flag the file is being generated</span>
    Session<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;generating&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//Show the notification</span>
    lblNotification<span style="color: #008000;">.</span><span style="color: #0000FF;">Style</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;display&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//direct the iframe to generate the file</span>
    ifrGeneratedFile<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;src&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> 
        <span style="color: #666666;">&quot;FileGenerator.aspx&quot;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//Enable the timer to check when the file has </span>
    <span style="color: #008080; font-style: italic;">//  finished being generated</span>
    tmrIndicator<span style="color: #008000;">.</span><span style="color: #0000FF;">Enabled</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Every time the timer ticks, check if the session variable &#8220;generating&#8221; is still true. When it is back to false disable the timer and hide the wait message.</p>

<div class="wp_codebox"><table><tr id="p32127"><td class="code" id="p321code27"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> tmrIndicator_Tick <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">//The timer is set to disabled by default</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//Every time the timer ticks, check if the </span>
    <span style="color: #008080; font-style: italic;">//  file is still being generated</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Session<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;generating&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">!=</span> <span style="color: #6666cc; font-weight: bold;">bool</span><span style="color: #008000;">.</span><span style="color: #0000FF;">TrueString</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">//if the file is finished being generated disable </span>
        <span style="color: #008080; font-style: italic;">//  the timer again and hide the notification</span>
        tmrIndicator<span style="color: #008000;">.</span><span style="color: #0000FF;">Enabled</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
        lblNotification<span style="color: #008000;">.</span><span style="color: #0000FF;">Style</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;display&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;none&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>In the page generating the image include the following line before ending the response.</p>

<div class="wp_codebox"><table><tr id="p32128"><td class="code" id="p321code28"><pre class="csharp" style="font-family:monospace;">Session<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;generating&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=321</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing CalendarExtender Plus</title>
		<link>http://lionsden.co.il/codeden/?p=222</link>
		<comments>http://lionsden.co.il/codeden/?p=222#comments</comments>
		<pubDate>Tue, 16 Jun 2009 20:19:27 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax Control Toolkit]]></category>
		<category><![CDATA[.NET 3.5]]></category>
		<category><![CDATA[3.0.30512]]></category>
		<category><![CDATA[CalendarExtender]]></category>
		<category><![CDATA[Date Range]]></category>
		<category><![CDATA[User Control]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=222</guid>
		<description><![CDATA[<p>The <strong>CalendarExtender Plus</strong> is a modification of the calendar extender that ships as part of the Ajax Control Toolkit. There are two main functionalities added to the control. First, you can limit the selectable dates to a specified date range. Second, there is now the option to show an alternate header. The new header includes two DropDown Lists, one to select the month and one to select the year.</p>]]></description>
			<content:encoded><![CDATA[<table width="100%">
<tr>
<td style="vertical-align:middle;">
            <img src="http://lionsden.co.il/codeden/wp-content/uploads/2009/05/max-may15.gif" alt="Maximum Date - May 15th, 2009" title="Maximum Date - May 15th, 2009" width="189" height="203" class="alignleft size-full wp-image-235" />
        </td>
<td style="vertical-align:middle;">
<div style="width:370px; padding:10px 3px 10px 3px; border-style:solid; border-width:1px; border-color:gray; ">
                <a href="http://lionsden.co.il/codeden/wp-content/plugins/download-monitor/download.php?id=CalendarExtenderPlus_1.0.2.0.zip" title="Download this solution">Click Here</a> to download the latest version of CalendarExtender Plus and documentation.
            </div>
<p>The <strong>CalendarExtender Plus</strong> is a modification of the calendar extender that ships as part of the Ajax Control Toolkit. There are two main features added to the control. First, you can limit the selectable dates to a specified date range. Second, there is now the option to show an alternate header. The new header includes two DropDown Lists, one to select the month and one to select the year.</p>
</td>
</tr>
</table>
<p>The available dates can be limited using the MaxDate and MinDate properties.</p>

<div class="wp_codebox"><table><tr id="p22229"><td class="code" id="p222code29"><pre class="html" style="font-family:monospace;">&lt;cc1:CalendarExtenderPlus runat=&quot;server&quot; ID=&quot;cepExample&quot; 
    TargetControlID=&quot;txtExample&quot; 
    MaximumDate=&quot;01/01/2009&quot; MinimumDate=&quot;5/15/2009 /&gt;</pre></td></tr></table></div>

<p>Setting the ShowDdlHeader to true will show the heading with dropDownLists to select the month and year.</p>

<div class="wp_codebox"><table><tr id="p22230"><td class="code" id="p222code30"><pre class="html" style="font-family:monospace;">&lt;cc1:CalendarExtenderPlus runat=&quot;server&quot; ID=&quot;cepHeaderExample&quot; 
    TargetControlID=&quot;txtExample&quot; ShowDdlHeader=&quot;true&quot; /&gt;</pre></td></tr></table></div>

<p><img src="http://lionsden.co.il/codeden/wp-content/uploads/2009/05/ddlmonth_open.gif" alt="DropDownList" title="DropDownList" width="184" height="231" class="alignright size-full wp-image-237" /></p>
<p>The Calendar Extender Plus has a few other enhancements, including the ability to show or hide the arrows in the heading to move back and forth a month, and a property to show or hide today&#8217;s date at the bottom of the calendar.</p>
<p>Since the CalendarExtender Plus is a modification of the standard extender it has all the properties and functionality of the original. It can be skinned using the normal css, and automatically fills the textBox with no need for additional javascript.</p>
<p>The CalendarExtender Plus is free to download, use, and distribute with your project.  Any feedback is greatly appreciated!</p>
]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=222</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>ComboBox ClientSide onChange Event</title>
		<link>http://lionsden.co.il/codeden/?p=299</link>
		<comments>http://lionsden.co.il/codeden/?p=299#comments</comments>
		<pubDate>Sun, 07 Jun 2009 14:57:20 +0000</pubDate>
		<dc:creator>Hanan Schwartzberg</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Ajax Control Toolkit]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Client Side]]></category>
		<category><![CDATA[.NET 3.5]]></category>
		<category><![CDATA[3.0.30512]]></category>
		<category><![CDATA[ComboBox]]></category>

		<guid isPermaLink="false">http://lionsden.co.il/codeden/?p=299</guid>
		<description><![CDATA[The Issue The comboBox has a couple of server side events to deal with field changing. OnSelectedIndexChanged OnTextChanged How can we catch the comboBox changing on the client side? The Solution Without access to these function on the client side, we need to use the client side events of the textBox that is contained within [...]]]></description>
			<content:encoded><![CDATA[<h4>The Issue</h4>
<p>The comboBox has a couple of server side events to deal with field changing.</p>
<ul>
<li>OnSelectedIndexChanged</li>
<li>OnTextChanged</li>
</ul>
<p>How can we catch the comboBox changing on the client side?</p>
<h4>The Solution</h4>
<p>Without access to these function on the client side, we need to use the client side events of the textBox that is contained within the comboBox. As with any textBox this one also has the onChange event, but the event does not run when the text was changed and the focus moved to another field. There are a few options:</p>
<ul>
<li>onKeyPress</li>
<li>onKeyUp</li>
<li>onBlur</li>
</ul>
<p>The problem with onKeyPress is when it gets to the javascript function the value of the textBox is has not changed yet, leaving onKeyUp and onBlur. While onKeyUp will give the desired effect when the user presses a key on the keyboard, part of the point of a comboBox is the ability to use the mouse, which will not be captured by this event, leaving onBlur as the remaining option. It&#8217;s still not perfect, since the event won&#8217;t run until the focus is moved off the comboBox, but it appears to be the best option. In some cases you may want to use both onKeyUp and onBlur to get the best of both events, but be careful because when the user uses the keyboard and the moves the focus your event will run twice.</p>
<p>In the example below I have a comboBox named cmbExample and a javascript function that accepts the textBox calling it as a parameter, cmbExample_OnBlur(textBox). I add the onBlur event to the textBox in the Page_Load method in the code behind.</p>

<div class="wp_codebox"><table><tr id="p29932"><td class="code" id="p299code32"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> Page_Load<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    TextBox textBox <span style="color: #008000;">=</span> cmbExample<span style="color: #008000;">.</span><span style="color: #0000FF;">FindControl</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;TextBox&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">as</span> TextBox<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>textBox <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        textBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;onBlur&quot;</span>, <span style="color: #666666;">&quot;cmbExample_OnBlur(this);&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://lionsden.co.il/codeden/?feed=rss2&amp;p=299</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
