<?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>shepherdweb.com &#187; web development</title>
	<atom:link href="http://shepherdweb.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://shepherdweb.com</link>
	<description>Shane Shepherd: web design and development; music</description>
	<lastBuildDate>Wed, 11 Nov 2009 01:46:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>ASP.NET Membership Provider Web Service</title>
		<link>http://shepherdweb.com/2009/10/31/asp-net-membership-provider-web-service/</link>
		<comments>http://shepherdweb.com/2009/10/31/asp-net-membership-provider-web-service/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 15:48:57 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://shepherdweb.com/?p=176</guid>
		<description><![CDATA[A couple of years ago I was in need of a full featured membership provider provided over web services. I found Shaun Wilde&#8217;s project. Shaun&#8217;s project provided a membership and role provider over web services, but lacked a profile provider. I added the profile provider. I ended up changing directions with the project I was [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of years ago I was in need of a full featured membership provider provided over web services.  I found <a href="http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx">Shaun Wilde&#8217;s project</a>.  Shaun&#8217;s project provided a membership and role provider over web services, but lacked a profile provider.  I added the profile provider.  </p>
<p>I ended up changing directions with the project I was working on and this code never got used in production.  Testing on it was minimal and I haven&#8217;t touched it two years.  However, I have received a large number of requests for the code&#8230;so here it is:</p>
<p><a href="http://shepherdweb.com/lab/2009/MembershipAgent/MembershipAgent.zip">ASP.NET 2.0 Web Service Membership, Role, and Profile Provider</a></p>
<p>Feel free to post enhancements or suggestions here.</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/asp.net" rel="tag">asp.net</a>, <a href="http://technorati.com/tag/membership+provider" rel="tag"> membership provider</a>, <a href="http://technorati.com/tag/role+provider" rel="tag"> role provider</a>, <a href="http://technorati.com/tag/profile+provider" rel="tag"> profile provider</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2009/10/31/asp-net-membership-provider-web-service/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IE7.js Beta 3</title>
		<link>http://shepherdweb.com/2008/10/26/ie7js-beta-3/</link>
		<comments>http://shepherdweb.com/2008/10/26/ie7js-beta-3/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 15:19:19 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[technology & web]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://shepherdweb.com/?p=170</guid>
		<description><![CDATA[I somehow failed to notice that Dean Edwards&#8217; IE7.js was bumped to beta 3 back in February. IE7.js is a javascript library which, when included in your web page, makes MSIE 5-6 behave like MSIE7. I found it to be extremely useful, particularly when dealing with png images. I&#8217;m looking for a change log to [...]]]></description>
			<content:encoded><![CDATA[<p>I somehow failed to notice that <a href="http://dean.edwards.name/">Dean Edwards&#8217;</a> <a href="http://code.google.com/p/ie7-js/">IE7.js</a> was bumped to beta 3 back in February.  IE7.js is a javascript library which, when included in your web page, makes MSIE 5-6 behave like MSIE7.  I found it to be extremely useful, particularly when dealing with png images.</p>
<p>I&#8217;m looking for a change log to find out what has changed from the original beta version to the beta 3 version.  Does this exist?</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/IE7" rel="tag">IE7</a>, <a href="http://technorati.com/tag/MSIE" rel="tag"> MSIE</a>, <a href="http://technorati.com/tag/Internet+Explorer" rel="tag"> Internet Explorer</a>, <a href="http://technorati.com/tag/png" rel="tag"> png</a>, <a href="http://technorati.com/tag/web+standards" rel="tag"> web standards</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2008/10/26/ie7js-beta-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SXSW 2008</title>
		<link>http://shepherdweb.com/2008/03/10/sxsw-2008/</link>
		<comments>http://shepherdweb.com/2008/03/10/sxsw-2008/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 01:33:57 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[SXSW]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://shepherdweb.com/2008/03/10/sxsw-2008/</guid>
		<description><![CDATA[I&#8217;m not there. But, one of my best friends&#8212;and my business partner Scott Faris is! If you see this guy walking around, go introduce yourself. Then say nice things about me to each other and while buying each other lunch. By the way, Scott and I recently finished FarisWheel 2.0. We had a lot of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not there.  But, one of my best friends&mdash;and my business partner <a href="http://fariswheel.com/">Scott Faris</a> is!  If you see this guy walking around, go introduce yourself.<br />
<img src='http://shepherdweb.com/wp-content/uploads/2008/03/scott3.jpg' alt='Scott Faris' /><br />
Then say nice things about me to each other and while buying each other lunch.   </p>
<p>By the way, Scott and I recently finished <a href="http://fariswheel.com/">FarisWheel 2.0</a>.   We had a lot of fun building a site for ourselves&mdash;and building it the way <em>we</em> wanted it&mdash;a welcome change from clients telling us what to do all the time.  </p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/sxsw" rel="tag">sxsw</a>, <a href="http://technorati.com/tag/sxsw2008" rel="tag"> sxsw2008</a>, <a href="http://technorati.com/tag/Fariswheel" rel="tag"> Fariswheel</a>, <a href="http://technorati.com/tag/Scott+Faris" rel="tag"> Scott Faris</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2008/03/10/sxsw-2008/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Select Element Z-index Ignored by IE 6 &#8211; Workaround</title>
		<link>http://shepherdweb.com/2007/02/14/z-index-ignored-for-select-element-in-ie-6-workaround/</link>
		<comments>http://shepherdweb.com/2007/02/14/z-index-ignored-for-select-element-in-ie-6-workaround/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 20:31:15 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2007/02/14/z-index-ignored-for-select-element-in-ie-6-workaround/</guid>
		<description><![CDATA[IE 6 will continue to be a problem for web developers for a while longer. Statistics for this site show that even though IE 7 has been out for several months, 30% of my visitors still use IE6. IE 7 is climbing fast (currently at 22%), but still has a ways to go before IE [...]]]></description>
			<content:encoded><![CDATA[<p>IE 6 will continue to be a problem for web developers for a while longer.  Statistics for this site show that even though IE 7 has been out for several months, 30% of my visitors still use IE6.  IE 7 is climbing fast (currently at 22%), but still has a ways to go before IE 6 moves into irrelevance.  I also suspect that the topics of my site draw more Firefox and Safari users than is typical on the  rest of the web.</p>
<p>I recently discovered this workaround for a scenario that is new to me.  Apparently this is a common problem.  However, being a developer who in the past has used little (if any) javascript in to build sites, I had not encountered it before.  </p>
<p>The bug, present in <abbr title="Internet Explorer">IE</abbr> 6 and below, is manifested when a positioned block should cover a <code>select</code> element in another layer.  This could occur easily with a dropdown menu or a popup layer that need to open over a form containing a <code>select</code> element.  The easiest way around this is to position the conflicting elements so that they do not interfere with each other.  However, if this is not possible, there is a workaround using the <code>iframe</code> element and IE conditional comments.</p>
<p><ins datetime="2/14/07 2:45pm"></p>
<p><a class="imagelink" href="http://www.shepherdweb.com/wp-content/uploads/2007/02/ie6-selectelement.jpg" title="IE 6 Screenshot"><img id="image122" src="http://www.shepherdweb.com/wp-content/uploads/2007/02/ie6-selectelement.thumbnail.jpg" alt="IE 6 Screenshot" /></a> IE 6 Screenshot &#8211; demonstrating the bug.  Shows two <code>select</code> elements poking through the positioned layer.</p>
<p><a class="imagelink" href="http://www.shepherdweb.com/wp-content/uploads/2007/02/ff-selectelement.jpg" title="Firefox Screenshot"><img id="image123" src="http://www.shepherdweb.com/wp-content/uploads/2007/02/ff-selectelement.thumbnail.jpg" alt="Firefox Screenshot" /></a> Firefox 2.0 Screenshot &#8211; the way it should be.  Shows the one <code>select</code> element that is actually in the positioned layer.  The two below it are hidden by the layer&#8217;s light-blue background.</p>
<p></ins></p>
<p>A few seconds of <a href="http://www.google.com/search?q=select+element+z-index+&#038;ie=utf-8&#038;oe=utf-8&#038;rls=org.mozilla:en-US:official&#038;client=firefox-a">Googling</a> turned up the following useful links:</p>
<ul>
<li><a href="http://www.hedgerwow.com/360/bugs/css-select-free.html">&lt;SELECT&gt; Free Layer</a></li>
<li><a href="http://throbs.net/web/articles/IE-SELECT-bugs/">SELECT elements ignore Z-index (&#8220;windowed element&#8221; problem)</a> (see bug #4)</li>
<li><a href="http://support.microsoft.com/kb/177378">How the Z-index Attribute Works for HTML Elements</a></li>
</ul>
<p>The first link offered a useful solution which I am abbreviating here:</p>
<p><code class="block">#popup iframe<br />
		{<br />
			display:none;/*sorry for IE5*/<br />
			display/**/:block;/*sorry for IE5*/<br />
			position:absolute;/*must have*/<br />
			top:0;/*must have*/<br />
			left:0;/*must have*/<br />
			z-index:-1;/*must have*/<br />
			filter:mask();/*must have*/<br />
			width: 100%;/*must have for any big value*/<br />
			height: 100%;/*must have for any big value*/;<br />
		}</code></p>
<p>In the linked example <code>width</code> and <code>height</code> are both set to <code>3000px</code>.  I found that it worked better for me to use <code>100%</code> instead since the former caused unnecessary scrollbars to appear on the page.</p>
<p><code class="block">	&lt;div id=&quot;bd&quot;&gt;<br />
		&lt;h1&gt;select element z-index workaround&lt;/h1&gt;<br />
		&lt;div class=&quot;parameter&quot;&gt;<br />
			&lt;label for=&quot;ddTest&quot;&gt;Test&lt;/label&gt;<br />
			&lt;select id=&quot;ddTest&quot;&gt;<br />
				&lt;option&gt;&amp;hellip;&lt;/option&gt;<br />
				&lt;option&gt;pick me&lt;/option&gt;<br />
			&lt;/select&gt;<br />
		&lt;/div&gt;<br />
	&lt;/div&gt;<br />
	&lt;div id=&quot;popup&quot;&gt;<br />
		Is the select element poking through?  It shouldn't be!<br />
		&lt;!--[if lte IE 6.5]&gt;&lt;iframe&gt;&lt;/iframe&gt;&lt;![endif]--&gt;<br />
	&lt;/div&gt;</code></p>
<p>Download the demo code: <a id="p121" rel="attachment" href="http://www.shepherdweb.com/2007/02/14/z-index-ignored-for-select-element-in-ie-6-workaround/select-element-z-index-workaround/" title="Select Element Z-index Workaround">Select Element Z-index Workaround Code</a></p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/IE" rel="tag">IE</a>, <a href="http://technorati.com/tag/select" rel="tag"> select</a>, <a href="http://technorati.com/tag/z-index" rel="tag"> z-index</a>, <a href="http://technorati.com/tag/CSS" rel="tag"> CSS</a>, <a href="http://technorati.com/tag/Internet+Explorer" rel="tag"> Internet Explorer</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2007/02/14/z-index-ignored-for-select-element-in-ie-6-workaround/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>How to Point CompareValidator&#8217;s ControlToCompare Attribute at a HiddenField</title>
		<link>http://shepherdweb.com/2007/01/30/how-to-point-comparevalidators-controltocompare-attribute-at-a-hiddenfield/</link>
		<comments>http://shepherdweb.com/2007/01/30/how-to-point-comparevalidators-controltocompare-attribute-at-a-hiddenfield/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 20:23:29 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2007/01/30/how-to-point-comparevalidators-controltocompare-attribute-at-a-hiddenfield/</guid>
		<description><![CDATA[If you point the ControlToCompare attribute of the CompareValidator at a HiddenField you&#8217;ll get an error that looks something like this: Control &#8216;hiddenBalance&#8217; referenced by the ControlToCompare property of &#8216;CompareValidator1&#8242; cannot be validated. With a small amount of &#8220;googling&#8221; I found two useful articles: Validating against the value in a hidden input MS KB Article [...]]]></description>
			<content:encoded><![CDATA[<p>If you point the <code>ControlToCompare</code> attribute of the <code>CompareValidator</code> at a <code>HiddenField</code> you&#8217;ll get an error that looks something like this:</p>
<blockquote><p>Control &#8216;hiddenBalance&#8217; referenced by the ControlToCompare property of &#8216;CompareValidator1&#8242; cannot be validated.</p>
</blockquote>
<p>With a small amount of &#8220;googling&#8221; I found two useful articles:</p>
<ul>
<li><a href="http://www.dotnet247.com/247reference/msgs/55/275332.aspx" title="newsgroup article from microsoft.public.dotnet.framework.aspnet.webcontrols">Validating against the value in a hidden input</a></li>
<li><a href="http://support.microsoft.com/kb/310082" title="How to extend a Web Form control to work with the validation controls by using Visual Basic .NET or Visual Basic 2005">MS KB Article 310082</a></li>
</ul>
<p>Between these two article I pieced together a solution.</p>
<h2>The Solution</h2>
<ol>
<li>Create a new web project and add it to your solution.  I called my project &#8220;CompareValidatorHelper&#8221;.</li>
<li>Right click on the project and select <em>Add</em> and the <em>Class&hellip;</em>.  I also named my class &#8220;CompareValidatorHelper&#8221;.</li>
<li>Paste the following C# code into the class:
<p><code class="block"><br />
using System;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.HtmlControls;<br />
using System.ComponentModel;<br />
namespace CompareValidatorHelper<br />
{<br />
    [DefaultProperty(&quot;Value&quot;), ValidationProperty(&quot;Value&quot;), ToolboxData(&quot;&lt;{0}:VHiddenField runat=server&gt;&lt;/{0}:VHiddenField&gt;&quot;)]<br />
    public class VHiddenField : System.Web.UI.WebControls.HiddenField<br />
    {<br />
    }<br />
}<br />
</code>
</li>
<li>Build the project and add a reference to it in your web application project.</li>
<li>Register the inherited control at the top of your page:<br />
<code class="block">&lt;%@ Register TagPrefix=&quot;custom&quot; Namespace=&quot;CompareValidatorHelper&quot; Assembly=&quot;CompareValidatorHelper&quot; %&gt;</code>
</li>
<li>Add the <code>HiddenField</code> control to your page:<br />
<code class="block">&lt;custom:VHiddenField ID=&quot;hiddenBalance&quot; runat=&quot;server&quot; Value='&lt;%# Eval(&quot;Balance&quot;) %&gt;' /&gt;</code>
</li>
<li>Finally, set the <code>ControlToCompare</code> attribute of your <code>CompareValidator</code> equal to the <code>ID</code> attribute of your <code>HiddenField</code>:<br />
<code class="block">&lt;asp:CompareValidator ID=&quot;CompareValidator1&quot; Display=&quot;Dynamic&quot; runat=&quot;server&quot; Type=&quot;Double&quot; Operator=&quot;LessThanEqual&quot; ErrorMessage=&quot;Overpayments are not allowed.&quot; ControlToCompare=&quot;hiddenBalance&quot; ControlToValidate=&quot;txtPaymentAmount&quot;&gt;*&lt;/asp:CompareValidator&gt;</code>
</li>
</ol>
<p><a href="http://www.dotnetkicks.com/kick/?url=http://www.shepherdweb.com/2007/01/30/how-to-point-comparevalidators-controltocompare-attribute-at-a-hiddenfield/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.shepherdweb.com/2007/01/30/how-to-point-comparevalidators-controltocompare-attribute-at-a-hiddenfield/" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/ASP.NET" rel="tag">ASP.NET</a>, <a href="http://technorati.com/tag/CompareValidator" rel="tag"> CompareValidator</a>, <a href="http://technorati.com/tag/ControlToCompare" rel="tag"> ControlToCompare</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2007/01/30/how-to-point-comparevalidators-controltocompare-attribute-at-a-hiddenfield/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using the CakePHP selectTag HtmlHelper</title>
		<link>http://shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/</link>
		<comments>http://shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 04:46:18 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/</guid>
		<description><![CDATA[The use of the selectTag HtmlHelper seems to be confusing to a lot of people (judging from the popularity of questions about it in the CakePHP Google Group). Hopefully I can clear up a few things about it. Parameters selectTag ($fieldName, $optionElements, $selected=null, $selectAttr=array(), $optionAttr=null, $showEmpty=true, $return=false) $fieldName will typically be the name of your [...]]]></description>
			<content:encoded><![CDATA[<p>The use of the <a href="http://api.cakephp.org/class_html_helper.html#dc661e84e1710023d94691fad33f40ec">selectTag</a> <a href="http://api.cakephp.org/class_html_helper.html">HtmlHelper</a> seems to be confusing to a lot of people (judging from the <a href="http://groups-beta.google.com/group/cake-php/search?group=cake-php&#038;q=selectTag&#038;qt_g=Search+this+group">popularity</a> of questions about it in the <a href="http://groups-beta.google.com/group/cake-php">CakePHP Google Group</a>).  Hopefully I can clear up a few things about it.</p>
<h2>Parameters</h2>
<p>selectTag ($fieldName, $optionElements, $selected=null, $selectAttr=array(), $optionAttr=null, $showEmpty=true, $return=false)</p>
<p><code>$fieldName</code> will typically be the name of your model in the singular slash (&#8216;/&#8217;) the primary key: <code>'Post/post_id'</code>.</p>
<p><code>$optionElements</code> is an array of &#8216;value&#8217; =>&#8217;text&#8217; pairs.  The <a href="http://api.cakephp.org/class_model.html#e8844b859626edc554946480046e395f">generateList</a> method is very useful for creating this array.</p>
<p><code>$selected</code> defaults to null and can be used to set the selected option.</p>
<p><code>$selectAttr</code> is an array. It is used to define HTML attributes for the opening <code>select</code> element: <code>array('onclick' => 'myfunction();', 'class' => 'cssclassname')</code></p>
<p><code>$optionAttr </code> serves the same purpose that <code>$selectAttr</code> does, except it applies to the <code>option</code> elements.</p>
<p><code>$showEmpty</code> is used to set whether or not the list has an empty option at the top.  The default is true.  If changed to false, the first <code>option</code> element will be the first value/text pair in your <code>$optionElements</code> array.</p>
<p><code>$return</code> default is false and it defines whether or not this method should return a value.  I don&#8217;t know of any reason why this would ever be set to true.  If someone knows of a scenario where this is useful, please share!</p>
<h2>Application</h2>
<p>Like other HtmlHelpers, the selectTag can be used in a View within the CakePHP MVC framework including Layouts and Helpers.  Typically you would load some data to an array in a <code>'value' =>'text'</code> pair arrangement before calling the selectTag method (example 1).  However, the array can be built &#8220;on the fly&#8221; as well (example 2).</p>
<h5>Example 1</h5>
<p><code class="block"><br />
&lt;?php $agentArray = $this-&gt;requestAction('/agents/select'); ?&gt;<br />
&lt;?=$html-&gt;selectTag('Agent/agent_id', $agentArray, null, array(), null, true, false);?&gt;<br />
</code></p>
<h5>Example 2</h5>
<p><code class="block"><br />
&lt;?=$html-&gt;selectTag('Listing/price',<br />
					array(<br />
						'0' =&gt; 'no min',<br />
						'50000' =&gt; '50,000',<br />
						'100000' =&gt; '100,000',<br />
						'125000' =&gt; '125,000',<br />
						'150000' =&gt; '150,000',<br />
						'175000' =&gt; '175,000',<br />
						'200000' =&gt; '200,000'), '0', array(), null, false, false); ?&gt;<br />
</code></p>
<p>This is by no means comprehensive, but hopefully useful.  The <a href="">CakePHP Google Group</a> and <a href="http://irc.cakephp.org/irc.html">CakePHP IRC Channel</a> are super when trying to wrap you head around something new.</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/CakePHP" rel="tag">CakePHP</a>, <a href="http://technorati.com/tag/selectTag" rel="tag"> selectTag</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Building and Implementing a Custom Atlas Extender with Visual Studio 2005</title>
		<link>http://shepherdweb.com/2006/08/24/building-and-implementing-a-custom-atlas-extender-with-visual-studio-2005/</link>
		<comments>http://shepherdweb.com/2006/08/24/building-and-implementing-a-custom-atlas-extender-with-visual-studio-2005/#comments</comments>
		<pubDate>Fri, 25 Aug 2006 01:15:38 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Atlas]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[technology & web]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2006/08/24/building-and-implementing-a-custom-atlas-extender-with-visual-studio-2005/</guid>
		<description><![CDATA[Pre-requisites: Atlas Framework Atlas Control Toolkit Summary The Atlas Control Toolkit site does a good job a walking through all the steps necessary to build a custom extender. You&#8217;ll want to refer to that site for more general detail. I&#8217;m going to show you my own custom implementation. I needed a control that would sum [...]]]></description>
			<content:encoded><![CDATA[<h2>Pre-requisites:</h2>
<ol>
<li><a href="http://atlas.asp.net/">Atlas Framework</a></li>
<li><a href="http://atlas.asp.net/default.aspx?tabid=47&#038;subtabid=477">Atlas Control Toolkit</a></li>
</ol>
<h2>Summary</h2>
<p>The Atlas Control Toolkit site does a good job a walking through all the steps necessary to build a <a href="http://atlas.asp.net/atlastoolkit/Walkthrough/CreatingNewExtender.aspx">custom extender</a>.  You&#8217;ll want to refer to that site for more general detail.  I&#8217;m going to show you my own custom implementation.</p>
<p>I needed a control that would sum all the TextBoxes on a page, using the <code>onchange</code> event, and display the answer in another TextBox.  For my purposes, the input is limited to integers, but it could easily be adapted to handle other numeric input.  I call my Atlas extender &#8220;SumTextboxes&#8221;.</p>
<h2>Getting Started</h2>
<p>Create a new project.  You can do this one of three ways:</p>
<ul>
<li>Go to <em>File->New Project&#8230;</em>;</li>
<li><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>N</kbd>;</li>
<li>Right Click on a solution that is already open and select <em>Add->New Project&#8230;</em></li>
</ul>
<p><img src="/images/posts/20060824_AtlasTutorial/AddNewProject.jpg" width="550" height="333" alt="Add New Project Window"  /></p>
<p>All three methods will open up the <strong>Add New Project</strong> dialog.  Select your language preference (<acronym title="Visual Basic">VB</acronym> or C#) the <strong>&#8220;Atlas&#8221; Control Project</strong>.  The Atlas Control Project does not exist for any other languages right now.  Give your project a name and specify the location.</p>
<p><img src="/images/posts/20060824_AtlasTutorial/AddNewItem.jpg" width="550" height="315" alt="Add New Item Window"  /></p>
<p>Next, right click on your new project and select <em>Add->New Item&#8230;</em>.  This will open the <strong>Add New Item</strong> dialog.  Choose the <strong>&#8220;Atlas&#8221; Extender Control</strong> template, give it a name, and click <em>Add</em>.  Four files appear in your project.  These are the base files needed to build a custom extender.</p>
<p><img src="/images/posts/20060824_AtlasTutorial/NewItemFiles.jpg" width="254" height="153" alt="Atlas Extender Template Files"  /></p>
<h2>Write the Code</h2>
<p>Open all four of the template files and make the following changes:</p>
<dl>
<dt>SumTextboxesDesigner.cs</dt>
<dd>Change the word <code>Control</code> to the more specific <code>TextBox</code>.</dd>
<dt>SumTextboxesExtender.cs</dt>
<dd>Same thing: Change the word <code>Control</code> to the more specific <code>TextBox</code>.</dd>
<dt>SumTextboxesProperties.cs</dt>
<dd>Looks like this:<br />
<code class="block"><br />
    [DefaultProperty("TargetResultTextBoxID")]<br />
    public class SumTextboxesProperties : TargetControlPropertiesBase&lt;TextBox&gt;<br />
    {<br />
        // TODO: Add your property accessors here.<br />
        //<br />
        [IDReferenceProperty(typeof(TextBox))]<br />
        public string TargetResultTextBoxID<br />
        {<br />
            get<br />
            {<br />
                return GetPropertyStringValue("TargetResultTextBoxID");<br />
            }<br />
            set<br />
            {<br />
                SetPropertyStringValue("TargetResultTextBoxID", value);<br />
            }<br />
        }<br />
    }<br />
</code></p>
</dd>
<dt>SumTextboxesBehavior.js</dt>
<dd>First, initialize your property variable: <code>var _TargetResultTextBoxIDValue;</code>.  You can delete the <code>this._onkeyup</code> function; create a new function called <code>this._onchange</code>&#8230;we&#8217;ll get to the code for _onchange in a second.  Change the initialize function to look like this:<br />
<code class="block"><br />
    this.initialize = function() {<br />
        SumTextboxes.SumTextboxesBehavior.callBaseMethod(this, 'initialize');<br />
        // TODO: add your initalization code here<br />
        this.control.element.attachEvent('onchange', Function.createDelegate(this, this._onchange));<br />
        this._onchange();<br />
    }<br />
</code></p>
<p>You will also need to change the code inside <code>this.getDescriptor</code> to this:<br />
<code class="block">td.addProperty('TargetResultTextBoxID', String);</code></p>
<p>&#8230;and your property accessors:<br />
<code class="block"><br />
    // These are helper functions for communicating state back to the extender on the<br />
    // server side.  They take or return a custom string that is available in your initialize method<br />
    // and later.<br />
    //<br />
    this.getClientState = function() {<br />
        var value = SumTextboxes.SumTextboxesBehavior.callBaseMethod(this, 'get_ClientState');<br />
        if (value == '') value = null;<br />
        return value;<br />
    }<br />
  //<br />
    this.setClientState = function(value) {<br />
        return SumTextboxes.SumTextboxesBehavior.callBaseMethod(this, 'set_ClientState',[value]);<br />
    }<br />
</code></p>
<p>And finally, back to <code>this._onchange</code>.  This is where the meat of this extender is:<br />
<code class="block"><br />
    this._onchange = function() {<br />
        if (!document.getElementsByTagName)<br />
        {<br />
            return;<br />
        }<br />
        var e = document.getElementById(_TargetResultTextBoxIDValue);<br />
        var total = 0;<br />
        oTextboxes = new Array();<br />
        oInputs = document.getElementsByTagName('input');<br />
        for (i=0;i<oInputs.length;i++)<br />
        {<br />
            if (oInputs[i].type == 'text')<br />
            {<br />
                oTextboxes.push(oInputs[i]);<br />
            }<br />
        }<br />
        var msg = "Found " + oTextboxes.length + " text boxes";<br />
        for (i=0;i<oTextboxes.length;i++)<br />
        {<br />
            if (!isNaN(parseInt(oTextboxes[i].value)) &#038;&#038; oTextboxes[i] != e)<br />
            {<br />
                total += parseInt(oTextboxes[i].value);<br />
            }<br />
        }<br />
        e.value = total;<br />
    }<br />
</code> </p>
</dd>
</dl>
<p>You're almost done!  Save the project and build.  You can now use this extender in an ASP.NET website!  </p>
<h2>Implementation</h2>
<p><img src="/images/posts/20060824_AtlasTutorial/AddReference.jpg" width="481" height="392" alt="Add Reference Window"  /></p>
<p>Add a reference to SumTextboxes in the project by right clicking on the project and selection <em>Add Reference...</em>.  This will open the <strong>Add Reference</strong> dialog.  Select the <em>Projects</em> tab, the <em>SumTextboxes</em> project, and click OK.</p>
<p><img src="/images/posts/20060824_AtlasTutorial/Toolbar-ScriptManagerControl.jpg" width="192" height="280" alt="Toolbar - Atlas Script Manager Control"  /></p>
<p>Drag a ScriptManager control from your toolbar onto the design view.  This is control is required for Atlas enabled applications.</p>
<p><img src="/images/posts/20060824_AtlasTutorial/TextboxesScreenshot.jpg" width="360" height="240" alt="Textboxes Screenshot"  /></p>
<p>Add some TextBoxes to your page.  For each TextBox, you will also need a SumTextboxes control.  I chose to use another Atlas Extender, the <a href="http://atlas.asp.net/atlastoolkit/FilteredTextBox/FilteredTextBox.aspx">FilteredTextBoxExtender</a> to restrict the user input to numbers.  Here's a snippet of my code for each textbox:<br />
<code class="block"><br />
&lt;asp:Label ID=&quot;lblHundreds&quot; runat=&quot;server&quot; AssociatedControlID=&quot;txtHundreds&quot;&gt;Hundreds (100s):&lt;/asp:Label&gt;<br />
            &lt;cc2:FilteredTextBoxExtender ID=&quot;FilteredTextBoxExtender1&quot; runat=&quot;server&quot;&gt;<br />
                &lt;cc2:FilteredTextBoxProperties TargetControlID=&quot;txtHundreds&quot; FilterType=&quot;numbers&quot; /&gt;<br />
            &lt;/cc2:FilteredTextBoxExtender&gt;<br />
            &lt;cc3:SumTextboxesExtender ID=&quot;SumTextboxesExtender1&quot; runat=&quot;server&quot;&gt;<br />
                &lt;cc3:SumTextboxesProperties<br />
                    TargetControlID=&quot;txtHundreds&quot;<br />
                    TargetResultTextBoxID=&quot;txtTotal&quot; /&gt;<br />
            &lt;/cc3:SumTextboxesExtender&gt;<br />
            $&lt;asp:TextBox ID=&quot;txtHundreds&quot; runat=&quot;server&quot; Text=&quot;0&quot; /&gt;.00<br />
</code></p>
<p>Notice that the TargetResultTextBoxID property has been set to "txtTotal".  txtTotal is the TextBox control at the bottom of the page where the results are displayed.  It is updated everytime the user tabs off a field that has the SumTextboxes control attached to it! </p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http://www.shepherdweb.com/2006/08/24/building-and-implementing-a-custom-atlas-extender-with-visual-studio-2005/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.shepherdweb.com/2006/08/24/building-and-implementing-a-custom-atlas-extender-with-visual-studio-2005/" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/atlas" rel="tag">atlas</a>, <a href="http://technorati.com/tag/atlas.net" rel="tag"> atlas.net</a>, <a href="http://technorati.com/tag/asp.net" rel="tag"> asp.net</a>, <a href="http://technorati.com/tag/visual+studio" rel="tag"> visual studio</a>, <a href="http://technorati.com/tag/atlas+extender" rel="tag"> atlas extender</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2006/08/24/building-and-implementing-a-custom-atlas-extender-with-visual-studio-2005/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

