<?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>amptools &#187; tag</title>
	<atom:link href="http://www.amptools.net/tag/tag/feed" rel="self" type="application/rss+xml" />
	<link>http://www.amptools.net</link>
	<description>Simplify your life.</description>
	<lastBuildDate>Sat, 08 May 2010 07:40:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Asp.Net Mvc Add Css Classes To The Body Element</title>
		<link>http://www.amptools.net/blog/asp-net-mvc-add-css-classes-to-the-body-element</link>
		<comments>http://www.amptools.net/blog/asp-net-mvc-add-css-classes-to-the-body-element#comments</comments>
		<pubDate>Thu, 15 Oct 2009 07:00:42 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[#AspNetMvc]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[body]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[name]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=234</guid>
		<description><![CDATA[Using the css classes on the body tag/element, you can open a door to having finer control over the layout of your site. Its one of the few decent tricks that bigger Content/Course Management Software like drupal or moodle provides. 
In Asp.Net Mvc this can be done in the master page, outside of the head [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>Using the css classes on the body tag/element, you can open a door to having finer control over the layout of your site. Its one of the few decent tricks that bigger Content/Course Management Software like drupal or moodle provides. </p>
<p>In Asp.Net Mvc this can be done in the master page, outside of the head tags.  What makes this nice is using the controller and action name to isolate the page and section of the site you are int.     </p>
<pre class="brush: csharp;">
&lt;/head&gt;
&lt;%
        var values = Html.ViewContext.RouteData.Values;
        var bodyClasses = values[&quot;controller&quot;] + &quot; &quot; +
                        values[&quot;action&quot;];
%&gt;
</pre>
<pre class="brush: xml;">
// in the master page
&lt;body class=&quot;&lt;%= bodyClasses %&gt;&quot;&gt; 

// what should be rendered for the url: /blog/edit/5
&lt;body class=&quot;blog edit&quot;&gt;
</pre>
<p>As you can see above, it would pay off to stick to using the controller and action keywords in your routing.  You could adjust the above for adding the modules/areas name. </p>
<pre class="brush: css;">
.blog aside.column {
        display: none;
}

.blog.edit  footer {
        margin-top: 20px;
        background: transparent(images/egg.png) no-repeat;
}
</pre>
<p>You can now target certain aspects of the layout and change it depending what section of the site you are in.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/asp-net-mvc-add-css-classes-to-the-body-element/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->