<?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>Marc Dormey &#187; html</title>
	<atom:link href="http://www.marcdormey.com/index.php/tags/html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.marcdormey.com</link>
	<description>Software Finds, Programming Tutorials and Gadget Reviews</description>
	<lastBuildDate>Tue, 20 Jul 2010 14:52:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Yes/No Dropdownlist Extension for ASP.NET MVC</title>
		<link>http://www.marcdormey.com/index.php/archives/yesno-dropdownlist-extension-for-asp-net-mvc</link>
		<comments>http://www.marcdormey.com/index.php/archives/yesno-dropdownlist-extension-for-asp-net-mvc#comments</comments>
		<pubDate>Wed, 14 Oct 2009 09:51:21 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSS/Html]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.marcdormey.com/?p=222</guid>
		<description><![CDATA[I am not a big fan of using checkboxes for a simple yes/no question on a form. I use checkboxes only for selecting multiple items to perform an action on, or when I am using a checkboxlist. The reason for this is because I believe a yes/no question has three possible states, not only two. [...]]]></description>
			<content:encoded><![CDATA[<p>I am not a big fan of using checkboxes for a simple yes/no question on a form. I use checkboxes only for selecting multiple items to perform an action on, or when I am using a checkboxlist. The reason for this is because I believe a yes/no question has three possible states, not only two. </p>
<p>If you are asking a user &#8220;Do you agree with our terms?&#8221;, the general consensus is to assume that not clicking the box is &#8220;forgetting&#8221; to make a selection and warning me that &#8220;You have forgotten to tick our terms and conditions&#8221;. In this situation the case may be so, but what if I did not agree? What if the question was &#8220;Do you want to opt out of us sending you loads and loads of spam?&#8221; and simply not spotting this question.</p>
<p>I believe that if you did not make a selection it is a valid state. Thus a yes/no question, in my opinion, has the following states; &#8220;yes&#8221;, &#8220;no&#8221; and &#8220;did not choose&#8221;.<br />
Once again, I don&#8217;t simply rant, I also offer a solution&#8230; a very simple extension method which I love using for all my yes/no questions instead of checkboxes. In this case I made the &#8220;not selected&#8221; state 0.</p>
<p></p>
<pre class="brush:csharp">
public static string YesNoDropDownList(this HtmlHelper helper, string id, string selectedValue)
        {

            var list = new SelectList(new[]
                              {
                                  new {text = "Select", value = "0"},
                                  new {text = "No", value = "1"},
                                  new {text = "Yes", value = "2"}
                              }, "value", "text", selectedValue);

            return helper.DropDownList(id, list);
        }
</pre>
<p>PS: It also looks a bit neater and more uniform.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcdormey.com/index.php/archives/yesno-dropdownlist-extension-for-asp-net-mvc/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Splitting your dynamic unordered list into columns</title>
		<link>http://www.marcdormey.com/index.php/archives/splitting-your-dynamic-unordered-list-into-columns</link>
		<comments>http://www.marcdormey.com/index.php/archives/splitting-your-dynamic-unordered-list-into-columns#comments</comments>
		<pubDate>Mon, 07 Sep 2009 17:22:01 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[CSS/Html]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[ul]]></category>

		<guid isPermaLink="false">http://www.marcdormey.com/?p=122</guid>
		<description><![CDATA[The easiest way to split your unordered list into columns is by assigning css classes.
&#60;ul&#62;
&#60;li class="left"&#62;Item 1&#60;/li&#62;
&#60;li class="left"&#62;Item 2&#60;/li&#62;
&#60;li class="right_first"&#62;Item 3&#60;/li&#62;
&#60;li class="right"&#62;Item 4&#60;/li&#62;
&#60;/ul&#62;
.left {
margin-left: 0px;
}

.right {
margin-left: 50%;
}

.right_first {
margin-top: -40px;
}
If you know the size of the list then you can play around with the top margin of the &#8220;right_first&#8221; class. In our case, we do not [...]]]></description>
			<content:encoded><![CDATA[<p>The easiest way to split your unordered list into columns is by assigning css classes.</p>
<pre class="brush:xml">&lt;ul&gt;
&lt;li class="left"&gt;Item 1&lt;/li&gt;
&lt;li class="left"&gt;Item 2&lt;/li&gt;
&lt;li class="right_first"&gt;Item 3&lt;/li&gt;
&lt;li class="right"&gt;Item 4&lt;/li&gt;
&lt;/ul&gt;</pre>
<pre class="brush:css">.left {
margin-left: 0px;
}

.right {
margin-left: 50%;
}

.right_first {
margin-top: -40px;
}</pre>
<p>If you know the size of the list then you can play around with the top margin of the &#8220;right_first&#8221; class. In our case, we do not know the size of the list, so we would have to do some black magic&#8230;</p>
<pre class="brush:js">// First we calculate some variables
// the minimum column length (items / 2) at which to split into columns
var columnSplitLength = 7;
// the current would be column length
var currentColumnLength = Math.round(items.length / 2);
// is the items an odd or even length
var isOdd = (items.length &gt; 2) != currentColumnLength;
// should we split the columns?
var shouldSplitColumns = currentColumnLength &gt; columnSplitLength; 

var count = 1; var myLiHeight = 13; // height of each ListItem

$.each(items, function() {
    var className = shouldSplitColumns &amp;&amp;  (count &gt; currentColumnLength) ? "right":"left";
    if(count == currentColumnLength+1)
        className = "right_first";
    var resultRow = $.stringFormat("&lt;li class='{0}'&gt;{1}&lt;/li&gt;", [className, this.name]);
    $(resultRow).appendTo("#myUlList");
    count++;
});

// If the list length is odd, we have to add a phantom item to the right to balance
if(isOdd) {
 $("&lt;li class='right'&gt;&lt;/li&gt;").appendTo("#myUlList");
count++;
}
// Lastly, reset the first item of the right column to the top
$(".right_first").css("margin-left", "50%");
$(".right_first").css("margin-top", "-"+count*myLiHeight+"px");</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.marcdormey.com/index.php/archives/splitting-your-dynamic-unordered-list-into-columns/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
