<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
        <title>lancefisher.net</title>
        <link>http://lancefisher.net/blog/Default.aspx</link>
        <description>.net, the web, and life</description>
        <language>en-US</language>
        <copyright>Lance</copyright>
        <managingEditor>lance.fisher@gmail.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <image>
            <title>lancefisher.net</title>
            <url>http://lancefisher.net/blog/images/RSS2Image.gif</url>
            <link>http://lancefisher.net/blog/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/lancefisher" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
            <title>Visual Studio 2008 Intellisense for jQuery 1.2.5</title>
            <link>http://lancefisher.net/blog/archive/2008/05/21/visual-studio-2008-intellisense-for-jquery-1.2.5.aspx</link>
            <description>&lt;p&gt;Download: &lt;a href="http://data.lancefisher.net/jquery-1.2.5-intellisense.js"&gt;jquery-1.2.5-intellisense.js&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Yesterday's release of jQuery 1.2.4 was a bad build.  That is part of the reason it was so easy to update the intellisense comments.  There just weren't many changes from 1.2.3 to 1.2.4.  So just one day later, the jQuery team has released jQuery 1.2.5.  It looks like the full &lt;a href="http://plugins.jquery.com/project/dimensions"&gt;Dimensions plugin&lt;/a&gt; is now rolled into jQuery.  Not just four methods as in the 1.2.4 release.&lt;/p&gt;  &lt;p&gt;I went through it, and added the XML comments for intellisense.  Again, &lt;a href="http://winmerge.org/"&gt;WinMerge&lt;/a&gt; made this relatively painless.  If you use it, get to know the alt-arrow key shortcuts:  &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;alt-down navigates to the next difference&lt;/li&gt;    &lt;li&gt;alt-up navigates to the previous difference&lt;/li&gt;    &lt;li&gt;alt-right moves the content on the left to the right&lt;/li&gt;    &lt;li&gt;alt-left moves the content on the right to the left.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;There are some new functions, and some of the old ones that were not working with intellisense are now fixed.  You should get intellisense on every function.  Some of these are pretty large since the intellisense hint needs to apply to several functions.  For instance, if you pull up the appendTo() hint, you'll see that it covers five functions.  That is because all these functions share the same code in the jQuery library.&lt;/p&gt;  &lt;p&gt;You might also be interested in trying out &lt;a href="http://brennan.offwhite.net/blog/2008/02/01/intellisense-for-jquery-in-visual-studio-2008/"&gt;Brennan Stehling's&lt;/a&gt; or &lt;a href="http://blogs.ipona.com/james/archive/2008/02/15/JQuery-IntelliSense-in-Visual-Studio-2008.aspx"&gt;James Hart's&lt;/a&gt; jQuery intellisense stubs.  They are different than this implementation in that they are not working jQuery JavaScript files.  They are built with function stubs to enable intellisense in Visual Studio, but your pages use the actual jQuery JavaScript.  What I've published here is the full jQuery 1.2.5 source code with the XML comments added in.  It should behave exactly as jQuery does.  You will probably want to deploy the &lt;a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.5.min.js"&gt;minimized version of jQuery&lt;/a&gt; rather than this to save on bandwidth and page load times.&lt;/p&gt;  &lt;p&gt;I'm still not sure whether a full copy of the library or the stub approach is better.  There are advantages of both.  What do you think?  Also, what do you think of moving this to a CodePlex project?&lt;/p&gt;  &lt;p&gt;Let me know if you run into any problems with this release.  I'll try and fix it and update this post.  Good luck!&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/12.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/05/21/visual-studio-2008-intellisense-for-jquery-1.2.5.aspx</guid>
            <pubDate>Wed, 21 May 2008 19:33:55 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/05/21/visual-studio-2008-intellisense-for-jquery-1.2.5.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/12.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Visual Studio 2008 Intellisense for jQuery 1.2.4</title>
            <link>http://lancefisher.net/blog/archive/2008/05/20/visual-studio-2008-intellisense-for-jquery-1.2.4.aspx</link>
            <description>&lt;h3&gt;Important Update&lt;/h3&gt;
&lt;p&gt;jQuery 1.2.4 was a bad build.  The jQuery team released jQuery 1.2.5 today.  I made a new post for &lt;a href="http://lancefisher.net/blog/archive/2008/05/21/visual-studio-2008-intellisense-for-jquery-1.2.5.aspx"&gt;jQuery 1.2.5 with Intellisnse&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Download: &lt;a href="http://data.lancefisher.net/jquery-1.2.4-intellisense.js"&gt;jquery-1.2.4-intellisense.js&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;jQuery 1.2.4 was released yesterday, so I wanted to update the jQuery &lt;a href="http://lancefisher.net/blog/archive/2008/02/12/intellisense-for-jquery-in-visual-studio-2008.aspx"&gt;Intellisense file I built for jQuery 1.2.3&lt;/a&gt;.  This is the full jQuery library with XML comments added to it so that Visual Studio will display intellisense hints for you.&lt;/p&gt;
&lt;p&gt;To use the intellisense verison of jQuery, just include the jquery-1.2.4-intellisense.js file in your project, and drag it from the Solution Explorer into your JavaScript file.  This will add a comment to the top of your .js file:&lt;/p&gt;
&lt;p&gt; &lt;img alt="" src="http://data.lancefisher.net/blog/2008-05-20/jQueryIntellisenseReference.JPG" /&gt; &lt;/p&gt;
&lt;p&gt;Also, you must have the &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/02/08/vs-2008-web-development-hot-fix-roll-up-available.aspx"&gt;Visual Studio 2008 Hot Fix Roll Up Patch&lt;/a&gt; installed.&lt;/p&gt;
&lt;p&gt;From looking at the source, there isn't a lot of new code in the update.  They've added four functions from the &lt;a href="http://plugins.jquery.com/project/dimensions"&gt;jQuery Dimensions plugin&lt;/a&gt;: &lt;a href="http://brandonaaron.net/docs/dimensions/#api-innerHeight"&gt;innerHeight&lt;/a&gt;(), &lt;a href="http://brandonaaron.net/docs/dimensions/#api-innerWidth"&gt;innerWidth&lt;/a&gt;(), &lt;a href="http://brandonaaron.net/docs/dimensions/#api-outerHeight"&gt;outerHeight&lt;/a&gt;(), and &lt;a href="http://brandonaaron.net/docs/dimensions/#api-outerWidth"&gt;outerWidth&lt;/a&gt;().  Other than that, there are a few changes to a few lines which I assume fix bugs.  For details you can read the &lt;a href="http://docs.jquery.com/Release:jQuery_1.2.4"&gt;jQuery 1.2.4 release notes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It was really quick to update the library with the XML comments.  Using &lt;a href="http://winmerge.org/"&gt;WinMerge&lt;/a&gt;, I loaded the jquery-1.2.3-intellisense.js file into the left side, and the new jquery-1.2.4.js file into the right side.  Then, I just went through the differences, and merged the XML comments from 1.2.3 to 1.2.4.  As far as I know the only API changes were the addition of the four functions from dimensions.  For these I used the documentation from the dimensions page since I couldn't find them in the &lt;a href="http://docs.jquery.com/Main_Page"&gt;jQuery documentation&lt;/a&gt;.  It actually took longer to write this post than to make the updates.&lt;/p&gt;
&lt;p&gt;If you run into any problems with the update, let me know and I'll fix it and post it.  Good luck!&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/11.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/05/20/visual-studio-2008-intellisense-for-jquery-1.2.4.aspx</guid>
            <pubDate>Wed, 21 May 2008 00:49:06 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/05/20/visual-studio-2008-intellisense-for-jquery-1.2.4.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/11.aspx</wfw:commentRss>
        </item>
        <item>
            <title>LINQ To SQL - CASE Statements</title>
            <link>http://lancefisher.net/blog/archive/2008/05/07/linq-to-sql---case-statements.aspx</link>
            <description>&lt;p&gt;In today's post we'll see how to make LINQ to SQL generate SQL CASE statements for us. &lt;/p&gt;  &lt;p&gt;Even though some people describe the SQL CASE statement as obscure or an edge case, I tend to use it quite a bit.  It's true that if you are dealing with a nicely designed database you can probably avoid it, but the sad fact is that I'm often not dealing with a nicely designed database.  Maybe you have this headache too.  Third-party vendors have a habit of making their databases ugly.&lt;/p&gt;  &lt;p&gt;One use for the CASE statement is displaying a description instead of a code when there isn't a lookup table.  Suppose there is a yes/no field that stores values as 1/0 in the database.  You can use a CASE statement to return yes or no instead of 1 or 0 like this:&lt;/p&gt;  &lt;p&gt; &lt;img src="http://data.lancefisher.net/blog/2008-05-07/CaseStatement.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;That's the easy example.  Often I'll find myself writing longer CASE statements to get around more difficult problems like this: &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/CaseStatement2.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;It can get much worse, but let's not get into that. &lt;/p&gt;  &lt;p&gt;I've been converting some of my data access over to LINQ in an effort to get rid of some stored procedures.  I want to simplify deployment, and I'd rather not put stored procedures in a third-party database.  A nice side effect of this work is that the LINQ turns out to be much more readable than the piles of T-SQL. &lt;/p&gt;  &lt;p&gt;One problem that I've seen people run into is &lt;a href="http://channel9.msdn.com/ShowPost.aspx?PostID=310823"&gt;how to write these CASE statements in LINQ&lt;/a&gt;.  There is no direct equivalent like "select", "from", and "orderby".  However, it is possible using C# language features.  In particular the &lt;a href="http://msdn.microsoft.com/en-us/library/ty67wk28(VS.80).aspx"&gt;ternary operator&lt;/a&gt;.  You may know it as the "?:" operator. &lt;/p&gt;  &lt;p&gt;The ternary operator takes the "if" statement and turns it into an expression.  Here's an example: &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/TernaryOperatorExample.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;The syntax is &amp;lt;condition&amp;gt;  ? &amp;lt;true value&amp;gt; : &amp;lt;false value&amp;gt; &lt;/p&gt;  &lt;p&gt;For this example we'll make a table in a SQL Server database and add some rows to it.  This will be a Plants table that contains rows of various plants and whether or not they are edible.  Create the table and data using the following commands: &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/CreatePlantsTable.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;Before we start writing our LINQ code, go get the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx"&gt;LINQ to SQL Debug Visualizer&lt;/a&gt;.  This will allow you to easily see the SQL that is being generated from your LINQ statement.  Scott Guthrie has the download on his blog as well as instructions on how to install and use it. &lt;/p&gt;  &lt;p&gt;Create a new project, and add a "LINQ to SQL Classes" dbml file.  We'll call it Plants.dbml.  From the Server Explorer, navigate to the table you created and drag it over to the dbml designer canvas to create the LINQ to SQL code for that table.  (For more on using LINQ to SQL be sure to read through &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx"&gt;Scott's series&lt;/a&gt;) &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/PlantsDbml.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;Now that we have the LINQ classes created, let's write some code to pull data from the table using LINQ.  Add a new class to your project.  We'll call it PlantsTest.cs.  I made this into an &lt;a href="http://www.mbunit.com/"&gt;MbUnit&lt;/a&gt; TestFixture.  That allows us to easily run methods from it using &lt;a href="http://www.testdriven.net/"&gt;TestDriven.net&lt;/a&gt;.  For this demo, that's all we care to do.  There will be no UI, just some code to debug. &lt;/p&gt;  &lt;p&gt;After you've created the class and marked it as a test fixture, add a method where we can write the LINQ code.  To start off, we'll just get all the data from the Plants table as is.  Here is the new class with the initial LINQ query.  I'm running it with the debugger using TestDriven.net.  You can see the SQL that is generated is pretty straight-forward. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/TestBasicSql.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;Now, let's add a basic case statement.  This will return the text "This is poisonous!" for plants with a 0 in the edible field, and "Okay to eat" otherwise.  By looking at the generated SQL using the debug visualizer, we can see that a CASE statement is in fact being generated. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/BasicLinqCase.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;Now the question will come up, "what if I want to have more than just one WHEN and an ELSE".  In other words, how do I add more cases.  Here's the trick: &lt;/p&gt;  &lt;p&gt;&lt;img src="http://data.lancefisher.net/blog/2008-05-07/ComplexCaseStatement.JPG" /&gt;&lt;/p&gt;  &lt;p&gt;By replacing the "if false" value of the ternary expression with another ternary expression we logically create the same effect as a SQL CASE statement.  Unlike the switch statement, this is an expression, and can be used on the right had side of the assignment operator.  LINQ to SQL is smart about handling this too.  It creates additional WHEN clauses inside of one CASE statement.  Just like you would if you were writing the SQL yourself.  The C# syntax forces you to have an ELSE clause.  That's a good thing. &lt;/p&gt;  &lt;p&gt;Some people might opt for writing in extra parenthesis to clearly show each ternary expression.  I think writing the statements without the parenthesis more clearly shows our intent, that is, making a CASE statement. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://data.lancefisher.net/blog/2008-05-07/LinqCase.zip"&gt;Download the source code&lt;/a&gt;&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/10.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/05/07/linq-to-sql---case-statements.aspx</guid>
            <pubDate>Wed, 07 May 2008 23:40:07 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/05/07/linq-to-sql---case-statements.aspx#feedback</comments>
            <slash:comments>8</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/10.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ASP.NET MVC Is POSHer than ASP.NET</title>
            <link>http://lancefisher.net/blog/archive/2008/04/16/asp.net-mvc-is-posher-than-asp.net.aspx</link>
            <description>&lt;p&gt;Over the last couple of years, I've started to develop something of an obession with web standards. Perhaps it's unhealthy for an ASP.NET developer. I'm not quite ready to call myself a "standarista", that's a little too metro for me, and I still have some bad habits lingering around. I'll often leave off &lt;a href="http://www.456bereastreet.com/archive/200412/the_alt_and_title_attributes/"&gt;title attributes&lt;/a&gt; for images or set the alt attribute to nothing. That's not so bad is it? However, I do see the importance of having &lt;a href="http://microformats.org/wiki/posh"&gt;semantic&lt;/a&gt; &lt;a href="http://www.456bereastreet.com/archive/200711/posh_plain_old_semantic_html/"&gt;markup&lt;/a&gt; (can you bring yourself to call it POSH?). It is easier to maintain, better for SEO and screen readers.&lt;/p&gt;
&lt;p&gt;One of the reasons I'm so excited about the new ASP.NET MVC Framework, is that you have total control over your markup. I can use ids on the client again! With traditional ASP.NET. You lost control over the ids as soon as you used a master page or user control, and who's going to try and build a site without those? ASP.NET does its best to protect you from having duplicate ids in your rendered markup so it adds on a bunch of prefixes to help you out (that and it's own selfish purposes like maintaining state). As it turns out, I'd rather if the framework didn't worry about it. I can handle that myself, thank you.&lt;/p&gt;
&lt;p&gt;So, after shedding the bagagge of a stateful framework, I'm coming back to what building websites is really about. HTML, CSS, and JavaScript. Not &amp;lt;asp:textbox /&amp;gt;, but &amp;lt;input type="test"&amp;gt;; not &amp;lt;asp:button&amp;gt;, but &amp;lt;input type="submit"&amp;gt;; etc. It really is liberating in a geeky, "the cruft of the web is dragging me down", sort-of way. It's good to know your HTML elements - all of them. Use the right one for the job, that's semantic markup. Don't just use a bunch of divs.&lt;/p&gt;
&lt;p&gt;While we were making ASP.NET Themes and AJAX server controls, developers on other platforms were building &lt;a href="http://www.prototypejs.org/"&gt;all kinds of&lt;/a&gt; &lt;a href="http://jquery.com/"&gt;great&lt;/a&gt; &lt;a href="http://developer.yahoo.com/yui/"&gt;JavaScript&lt;/a&gt; &lt;a href="http://extjs.com/"&gt;frameworks&lt;/a&gt; and pioneering great practices with CSS. Ideas like &lt;a href="http://www.digital-web.com/articles/markup_as_craft/"&gt;not putting JavaScipt in your markup&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;"One of the most wicked defilers of beautiful markup is inline JavaScript. This makes the markup all but impossible to read, and provides lots of little dark corners for bugs to hide."&lt;/blockquote&gt;
&lt;p&gt;Ideas like &lt;a href="http://www.molly.com/articles/markupandcss/2002-02-truelanguage1.php"&gt;CSS belongs in a different file&lt;/a&gt;. Then it's easier to participate in &lt;a href="http://naked.dustindiaz.com/"&gt;CSS Naked Day&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Yeah, beautiful markup is important. Yep, it's true.&lt;/p&gt;
&lt;p&gt;One technique that stuck with me and has helped out quite a bit in my day-to-day CSS work is writing all the CSS attributes on one line. I used to put each little attribute on its own line. They deserve their own lines write? Nope. Suprisingly enough, these little attributes are &lt;a href="http://orderedlist.com/articles/single-line-css"&gt;social creatures that like to travel around in packs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Consider the following CSS snippet:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;#header {margin: 0 auto; width: 889px; position: relative;}
#header h1 {background: url(img/header.png) no-repeat; width: 889px; height: 146px; position: relative;}
#header h1 a {margin-top: -100px; display: block; height: 250px; width: 257px; position: absolute;}
#header ul#topnav {position: absolute; top: 29px; left: 274px; width: 604px; height: 30px; list-style: none;}
#header ul#topnav li {width: 33% ; float: left; text-align: center;}
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;That's 5 lines. That's only a portion of the CSS for a website. It's easy to scan and find what elements I have assigned style to. Then I can look for for the styles I've applied. Had I put a line-break after each attribute, selector, and curly brace, I'd be up to 36 lines. Go &lt;a href="http://www.lonniebest.com/FormatCSS/"&gt;format it yourself&lt;/a&gt; and see. For a whole site, that can easily become more pages than you want to scroll through.&lt;/p&gt;
&lt;p&gt;I'll often over-specify the element I'm selecting. It might have been okay to just use "a" rather than "#header h1 a" in the CSS above, but then if I decide to style an anchor elsewhere in the page, I'd have to go back and undo what I've already done. Either by appling more selectors, or overriding the style. It's much easier to over-specify from the start. Plus it makes it easier to find things in your CSS.&lt;/p&gt;
&lt;p&gt;Often you'll want to have different styles in different pages on your website. Nothing too wild, but maybe on your home page you want the headers to be a little bit bigger. Perhaps you want an additional column on the home page, but on your article pages you get rid of a column and widen your main content area. There are all kinds of possibilities. In this scenario, it can be convient to &lt;a href="http://css-tricks.com/id-your-body-for-greater-css-control-and-specificity/"&gt;add an id to your body&lt;/a&gt;. &lt;a href="http://twitter.com/cwbrandsma/statuses/789661183"&gt;Why, you say?&lt;/a&gt; Well, you can have more than one body element... In a website. It's nice to keep all your CSS in one file (so long as it doesn't become too ridiculous). So if I wanted h2s on my homepage to be 2 ems while on an article page I wanted them to be only 1.5 ems I could do this:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;#home h2 {font-size: 2em;}
#article h2 {font-size: 1.5em;}
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;So how can we do this in ASP.NET MVC? With CTP2, if you create a new project, you get a master page by default. Then, when you add a view, you can add an MVC Content View Page. Unfortunately, it is terribly difficult to reach back up to the master page and set the body ID within the content view page. I haven't figured out a way to do it. Maybe you can. There is another way to go about it though. You can set the body id in your controller right before you render the view. This may make more sense anyway, since you may render the same view from multiple controller actions.&lt;/p&gt;
&lt;p&gt;The first step, is to modify the Site.Master page. Open it and change the body element like this:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;&amp;lt;body id="&amp;lt;%= ViewData["BodyId"] %&amp;gt;"&amp;gt;
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;Then in the controller, right before you render the view, set the view data:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;public void Index()
{
	ViewData["BodyId"] = "home";
	RenderView("Index");
}
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;If you want to get even more fancy/automatic, you could set the body id using the controller and action names:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;public void Index()
{
	ViewData["BodyId"] = RouteData.Values["controller"] + "_" + RouteData.Values["action"];
	RenderView("About");
}
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;That line could then be refactored in to a function, or into your very own view engine. Just watch out if you are going to be using typed views. In that case, you might want to look into the TempData Dictionary.&lt;/p&gt;
&lt;p&gt;For more great reading on Semantic HTML, CSS, and JavaScript be sure to check out the following sites:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;http://www.alistapart.com/ &lt;/li&gt;
    &lt;li&gt;http://www.456bereastreet.com/ &lt;/li&gt;
    &lt;li&gt;http://snook.ca/jonathan/ &lt;/li&gt;
    &lt;li&gt;http://mezzoblue.com/ &lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://lancefisher.net/blog/aggbug/9.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/04/16/asp.net-mvc-is-posher-than-asp.net.aspx</guid>
            <pubDate>Wed, 16 Apr 2008 07:42:58 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/04/16/asp.net-mvc-is-posher-than-asp.net.aspx#feedback</comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/9.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Tired of Visual Studio Telling You &amp;quot;The class or CssClass value is not defined&amp;quot;?</title>
            <link>http://lancefisher.net/blog/archive/2008/03/23/tired-of-visual-studio-telling-you-quotthe-class-or-cssclass.aspx</link>
            <description>&lt;p&gt;Sometimes you have classes in your HTML that are not in your CSS for one reason or another.  Maybe they are only used in your JavaScript.  If you are tired of Visual Studio giving you the warning "The class or CssClass value is not defined," there is a way to suppress it.  Here's my solution:&lt;/p&gt;
&lt;p&gt;First, add the following to the head element in your HTML document:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;&amp;lt;head runat="server"&amp;gt;
  &amp;lt;title&amp;gt;The Page&amp;lt;/title&amp;gt;
  &amp;lt;asp:Literal Visible="false" runat="server"&amp;gt;
    &amp;lt;link href="~/Content/SuppressCssWarnings.css" rel="stylesheet" type="text/css" /&amp;gt;
  &amp;lt;/asp:Literal&amp;gt;
  &amp;lt;!-- You probably have more here... --&amp;gt;
&amp;lt;/head&amp;gt;
&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;Notice, a few things here.  First, that there is a runat="server" in the head.  This is important for the ~ to work correctly.  I also think you need it in order to have any &amp;lt;asp: ...&amp;gt; control in the head.  The next thing to notice is the css file that has been added.  This is where you add all the classes that Visual Studio is warning you about.  Just cut and paste, it's not that bad.  Finally, see how the link to your stylesheet is inside the asp Literal control?  That keeps it from showing up in your rendered page.&lt;/p&gt;
&lt;p&gt;Inside the SuppressCssWarnings.css file is just a list of your classes like so:&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;/* The whole point of this css is to get VS off my back.  I'm sick of its "The class or CssClass value is not defined." */
.yui-skin-sam {}
.yuimenubar {}
.yuimenubarnav {}
.bd {}
.yuimenubaritem {}
.first-of-type {}
.yuimenubaritemlabel {}
.yuimenu {}
.yuimenuitem {}&lt;/pre&gt;
&lt;/code&gt;
&lt;p&gt;And that's it!  Good luck!  As you can see I've been working with &lt;a href="http://developer.yahoo.com/yui/"&gt;YUI&lt;/a&gt; recently.  Check it out, it's a good JavaScript library, and it should work especially well the the ASP.NET MVC Framework.&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/8.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/03/23/tired-of-visual-studio-telling-you-quotthe-class-or-cssclass.aspx</guid>
            <pubDate>Sun, 23 Mar 2008 10:32:14 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/03/23/tired-of-visual-studio-telling-you-quotthe-class-or-cssclass.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/8.aspx</wfw:commentRss>
        </item>
        <item>
            <title>I'm an Official Roadie!</title>
            <link>http://lancefisher.net/blog/archive/2008/03/18/im-an-official-roadie.aspx</link>
            <description>&lt;p&gt;It's true.  &lt;a href="http://thecodetrip.com/1/roadies-online"&gt;The Code Trip made me a roadie&lt;/a&gt;.  I even have a &lt;a href="http://thecodetrip.com/1/roadies"&gt;driver's license&lt;/a&gt;.  The Code Trip is a few Microsoft developers (and whoever else wants to jump on the bus) driving around the western U.S. programming and meeting developers along the way.  I met up with them down at Boise Code Camp, and a few days later they came through Missoula where I live.  Check out &lt;a href="http://thecodetrip.com/1/rolling-through-missoula-and-the-university-of-mon"&gt;my post&lt;/a&gt; over on The Code Trip site.&lt;/p&gt;  &lt;p&gt;I really wish I would have hopped on the bus to get back to Missoula from Code Camp.  I ended up taking the plane home Sunday night since I had already been gone from my wife and six-month-old son since Thursday.  The Code Trip came through Missoula on Wednesday.  It was great.  Hopefully they do another trip, or come back to visit our &lt;a href="http://tech.groups.yahoo.com/group/missouladotnet/"&gt;.NET Users Group&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/7.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/03/18/im-an-official-roadie.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 07:15:17 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/03/18/im-an-official-roadie.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/7.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Referencing JavaScript in ASP.NET MVC Master Pages</title>
            <link>http://lancefisher.net/blog/archive/2008/03/16/referencing-javascript-in-asp.net-mvc-master-pages.aspx</link>
            <description>&lt;p&gt;Here's a quick tip on including JavaScript files in your MVC master page views.  First off, put your .js file in the Content folder (or a sub-folder of it).  This folder is available directly over the web.  Next you need to reference the file in your master page.  In the head element use the following:&lt;/p&gt;  &lt;pre&gt;&lt;code&gt;&amp;lt;script src="Content/js/jquery-1.2.3.min.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But wait!  there's a problem with this.  Depending on what route has led to your view, the directory may be incorrect.  For example, "http://mymvcsite.com/about" will find the js just fine since the Content folder is a sibling folder to the about folder.  However, if your route was "http://mymvcsite.com/about/someaction", the script reference in your page will be looking for the file here: "http://mymvcsite.com/about/Content/jquery-1.2.3.min.js" and so your js won't work.  This problem doesn't seem to happen for css files.  The MVC rewrites the href to point to the correct place.&lt;/p&gt;

&lt;p&gt;There is a simple fix though.  Instead of specifying the js file directly, use the Url.Content() function.  For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;script src="&amp;lt;%= Url.Content("~/Content/js/jquery-1.2.3.min.js") %&amp;gt;" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Also note that the "~" will work in link elements to reference css, but not in script elements referencing JavaScript.  It would be nice if this is fixed in the next CTP.&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/5.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/03/16/referencing-javascript-in-asp.net-mvc-master-pages.aspx</guid>
            <pubDate>Sun, 16 Mar 2008 10:26:24 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/03/16/referencing-javascript-in-asp.net-mvc-master-pages.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/5.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Upgrading ASP.NET MVC CTP1 to CTP2</title>
            <link>http://lancefisher.net/blog/archive/2008/03/11/upgrading-asp.net-mvc-ctp1-to-ctp2.aspx</link>
            <description>&lt;p&gt;With the recent update to the ASP.NET MVC Framework, you may have applications that you've built with the first CTP that you'd like to upgrade to the new CTP2.  Microsoft has posted &lt;a title="Upgrading ASP.NET MVC from CTP1 to CTP2" href="http://www.asp.net/downloads/3.5-extensions/readme/Preview2.aspx#_Upgrading_an_MVC"&gt;instructions on how to upgrade your project&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I followed the instuctions, but I was noticing that when I tried to add new items to my project such as a new View Content Page, etc. the Add New Item dialog wasn't listing the MVC project items.  One of the changes in the new CTP has put the MVC project items into their own grouping in the dialog, which is very handy.  However, they weren't showing up in the upgraded project.  They should be under Web | MVC.&lt;/p&gt;
&lt;p&gt;In order to see the MVC project items you have to update the &amp;lt;ProjectTypeGuids&amp;gt; element in your .csproj file.  The new values should be: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&amp;lt;ProjectTypeGuids&amp;gt;
  {603c0e0b-db56-11dc-be95-000d561079b0};
  {349c5851-65df-11da-9384-00065b846f21};
  {fae04ec0-301f-11d3-bf4b-00c04f79efbc}
&amp;lt;/ProjectTypeGuids&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that I've written it here on several lines for readability, but in your .csproj file it must be all on one line like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&amp;lt;ProjectTypeGuids&amp;gt;{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}&amp;lt;/ProjectTypeGuids&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That lets the designer know to give you the correct items types in your Add New Item dialog. Thanks to &lt;a title="Andrew Hanson" href="http://andrewhanson.net/"&gt;Andrew&lt;/a&gt; for the help in getting this working.&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/4.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/03/11/upgrading-asp.net-mvc-ctp1-to-ctp2.aspx</guid>
            <pubDate>Tue, 11 Mar 2008 23:07:15 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/03/11/upgrading-asp.net-mvc-ctp1-to-ctp2.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/4.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Boise Code Camp 2008</title>
            <link>http://lancefisher.net/blog/archive/2008/03/08/boise-code-camp-2008.aspx</link>
            <description>&lt;p&gt;Thanks to everyone who attended my jQuery and ASP.NET session at &lt;a href="http://www.boisecodecamp.org/"&gt;Boise Code Camp&lt;/a&gt;. I hope to post a little tutorial in the next few days to cover what I wasn't able to get to in my demo. Sorry for the projector problems. &lt;/p&gt;
&lt;p&gt;In the meantime, here is the &lt;a title="Using jQuery in ASP.NET Slideshow and Code" href="http://data.lancefisher.net/jQueryAndAspNetDemo.zip"&gt;slideshow and code&lt;/a&gt;. The slide show is the default.htm file in the Slideshow folder. To go to the next slide hit Shift+k. To go to the previous slide hit Shift+j. Shift+h will take you to the first slide. The slideshow is actually built with HTML, jQuery, and a jQuery hotkeys plugin. Check it out for some more jQuery code examples.&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/3.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/03/08/boise-code-camp-2008.aspx</guid>
            <pubDate>Sun, 09 Mar 2008 04:56:44 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/03/08/boise-code-camp-2008.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/3.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Intellisense for jQuery in Visual Studio 2008</title>
            <link>http://lancefisher.net/blog/archive/2008/02/12/intellisense-for-jquery-in-visual-studio-2008.aspx</link>
            <description>&lt;p&gt;If you just want the annotated jQuery file download it here: &lt;a title="Annotated jQuery 1.2.3" href="http://data.lancefisher.net/jquery-1.2.3-intellisense.js"&gt;jQuery with Intellisense comments&lt;/a&gt;. For more about it, read on!&lt;/p&gt;
&lt;p&gt;I really like jQuery.  I might even say that I love jQuery.  It is a simple and elegant JavaScript framework.  The genius is that it realizes that what most people want to do with JavaScript is manipulate the DOM, and it makes doing that fun.  Look at this example from the &lt;a title="jQuery - a sweet JavaScript framework" href="http://jquery.com"&gt;jQuery home page&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
$("p.surprise").addClass("ohmy").show("slow");
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That will get all the p elements with the class surprise, add the class "ohmy", and then change the display to "block" with a slow animation. Go run it on the jQuery homepage.  Nice, eh?  The dollar function is magical.  You just give it a CSS selector, and it returns jQuery objects that you can do all kinds of cool things with.  Also, almost all the functions in the framework return this same jQuery object, so they are chainable like you see above.&lt;/p&gt;
&lt;p&gt;Now, I also really like ASP.NET, and with the new ASP.NET MVC Framework coming out, I might even say that I love ASP.NET.  I would really like to use jQuery in my ASP.NET projects, but it has never worked too well.  The JavaScript intellisense features of VS 2008 wouldn't work right.  When Visual Studio 2008 was released, it came with better support for JavaScript.  Unfortunately, it did not work with jQuery, but after only a few months, Microsoft released a &lt;a title="VS 2008 Hot-Fix Roll-Up Patch from ScottGu" href="http://weblogs.asp.net/scottgu/archive/2008/02/08/vs-2008-web-development-hot-fix-roll-up-available.aspx"&gt;"Hot-Fix Roll-Up" patch&lt;/a&gt;.  This will make the &lt;a title="Getting intellisense to work with jQuery" href="http://blogs.msdn.com/webdevtools/archive/2008/02/08/jscript-intellisense-working-with-jquery.aspx"&gt;intellisense work with jQuery&lt;/a&gt;, and fix some other things.&lt;/p&gt;
&lt;p&gt;In order for you to get all the great hints in intellisense, you need to have &lt;a title="JavaScript XML Comment formatting" href="http://weblogs.asp.net/bleroy/archive/2007/04/23/the-format-for-javascript-doc-comments.aspx"&gt;XML comments in your JavaScript&lt;/a&gt;.  So I spent yesterday afternoon commenting jQuery, and it is awesome!  &lt;a title="Annotated jQuery 1.2.3" href="http://data.lancefisher.net/jquery-1.2.3-intellisense.js"&gt;Download it yourself&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All you have to do to use it is include it in a script reference in your page, and add a reference comment in your .js file.  So in your HTML you'll have this under the head element:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
  &amp;lt;script src="jquery-1.2.3-intellisense.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script src="your.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then in your.js you'll need to tell VS about the jquery-1.2.3-intellisense.js file like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
/// &amp;lt;reference path="jquery-1.2.3-intellisense.js" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you'll have all the intellisense goodness for jQuery available in your.js.  You won't want to deploy the jquery-1.2.3-intellisense to production since it is quite a bit larger than the minified version, but for development it should work the same as jquery-1.2.3.  I didn't change any of the code, although in some cases it would have made for better intellisense.  Which brings me to my next point.&lt;/p&gt;
&lt;p&gt;I couldn't get everything to work due to the way the library is written, and the JavaScript comments work.  For instance, some functions like &lt;span&gt;append()&lt;/span&gt; in jQuery don't have parameters specified.  The functions still expect arguments, they just use the "arguments" array instead of formal parameters.  Another problem was that for serveral API functions, only one implemention is used.  For example the event helpers such as blur(), click(), focus(), etc. that fire events are the same function in jQuery.  For these, I've just written a generic XML comment.&lt;/p&gt;
&lt;p&gt;I'll be speaking at &lt;a title="Lance Fisher at Boise Code Camp" href="http://www.boisecodecamp.org/sessions"&gt;Boise Code Camp&lt;/a&gt; on March 8th about using jQuery with ASP.NET.  It will be mostly an introduction, with a walk-through on changing a plain old contact form, into a fancy-schmancy AJAX one using jQuery.  So if you're around stop by and say hi.  This was my first blog post, and Code Camp will be my first speaking engagement so some things may still be a little rough around the edges.  The nice thing about Code Camp is that you don't have to be invited to speak :)&lt;/p&gt;
&lt;h3&gt;Update 5/20/2008&lt;/h3&gt;
&lt;p&gt;jQuery 1.2.4 was released yesterday.  I just posted the updated &lt;a href="http://lancefisher.net/blog/archive/2008/05/20/visual-studio-2008-intellisense-for-jquery-1.2.4.aspx"&gt;jquery-1.2.4-intellisense&lt;/a&gt; file.&lt;/p&gt;
&lt;h3&gt;Update 5/21/2008&lt;/h3&gt;
&lt;p&gt;jQuery 1.2.5 was released today.  jQuery 1.2.4 was a bad build.  I just posted the updated &lt;a href="http://lancefisher.net/blog/archive/2008/05/21/visual-studio-2008-intellisense-for-jquery-1.2.5.aspx"&gt;jquery-1.2.5-intellisense&lt;/a&gt; file.&lt;/p&gt;&lt;img src="http://lancefisher.net/blog/aggbug/2.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance</dc:creator>
            <guid>http://lancefisher.net/blog/archive/2008/02/12/intellisense-for-jquery-in-visual-studio-2008.aspx</guid>
            <pubDate>Tue, 12 Feb 2008 17:49:36 GMT</pubDate>
            <comments>http://lancefisher.net/blog/archive/2008/02/12/intellisense-for-jquery-in-visual-studio-2008.aspx#feedback</comments>
            <slash:comments>23</slash:comments>
            <wfw:commentRss>http://lancefisher.net/blog/comments/commentRss/2.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
