<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" 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:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Ralph Whitbeck - Blog - ASP.NET MVC</title>
    <link>http://ralphwhitbeck.com/</link>
    <description />
    <language>en-us</language>
    <copyright>Ralph Whitbeck</copyright>
    <lastBuildDate>Thu, 21 May 2009 19:19:48 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.6264.0</generator>
    <managingEditor>ralph.whitbeck@gmail.com</managingEditor>
    <webMaster>ralph.whitbeck@gmail.com</webMaster>
    <item>
      <trackback:ping>http://ralphwhitbeck.com/Trackback.aspx?guid=a32cf09a-85ad-494f-874e-15d5c2348021</trackback:ping>
      <pingback:server>http://ralphwhitbeck.com/pingback.aspx</pingback:server>
      <pingback:target>http://ralphwhitbeck.com/PermaLink,guid,a32cf09a-85ad-494f-874e-15d5c2348021.aspx</pingback:target>
      <dc:creator>Ralph Whitbeck</dc:creator>
      <wfw:comment>http://ralphwhitbeck.com/CommentView,guid,a32cf09a-85ad-494f-874e-15d5c2348021.aspx</wfw:comment>
      <wfw:commentRss>http://ralphwhitbeck.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a32cf09a-85ad-494f-874e-15d5c2348021</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Microsoft recently released <a href="http://msdn.microsoft.com/en-us/netframework/dd819232.aspx">Visual
Studio 2010 and .NET 4.0 beta</a>.  I'd like to highlight some of the key new
features available to .NET 4.0.<br /><br /><p><b>Web Forms</b></p><ul><li>
Developers can manage control IDs that affect rendered client ID</li><li>
Remove ID bloat, and 'mangling'</li><li>
CSS: 
</li><ul><li>
Ideally remove the need to use CSS adapters</li><li>
Defer to CSS styles and bypass existing style properties</li><ul><li>
non-inline style attributes</li></ul><li>
Support non-table-based HTML rendering</li></ul><li>
URL-routing for web forms</li><ul><li>
Friendly url handling for web forms</li><li>
configuration model for url routing</li></ul><li>
View state</li><ul><li>
Disable on the page, enable on specific controls - they will provide granular control
of viewstate - today it is backwards</li><li>
Disable on control, enable on child controls</li><li>
GridView/ListView work better without viewstate</li></ul><li>
ASP.NET dynamic-data</li></ul><p><b>Ajax</b></p><ul><li>
Continue ASP.NET Ajax innovation : RIA</li><li>
Appeal to JavaScript Developers</li><li>
Provide support for the page developer</li><li>
jQuery including Intellisense</li><li>
Templates and data binding</li><ul><li>
Client side handling, REST or Web Services 
</li><li>
Covers page developer and component developer scenarios</li></ul><li>
DOM manipulation, selectors ...</li><li>
Ajax higher-level components</li><ul><li>
Ajax Control Toolkit is a part of the strategy - they will make the toolkit part of
the overall ASP.NET package</li><li>
New controls</li></ul><li>
Centralized script libraries and break-up for performance</li></ul><p><b>ASP.NET MVC</b></p><ul><li>
Appeal to those wanting separation of concerns, TDD, full control</li><li>
Ruby on Rails, Django, PHP</li><li>
Building on from ASP.NET MVC 1.0</li><li>
ASP.NET MVC (Model View Controller)</li><li>
Asynchronous controllers</li><li>
Sub-controllers &amp; Views</li><li>
Declarative controls</li></ul><p><b>ASP.NET Dynamic Data</b></p><ul><li>
Making building data-driven web apps easily</li><li>
Attacking the Ruby on Rails crowd</li><li>
Building on from FX3.5 SP1</li><li>
Dynamic-data and MVC</li><ul><li>
Scaffolding, templates and data validation</li></ul><li>
Support for abstract data layer</li><ul><li>
Removes need for specific DL (SQL, entities ...)</li><li>
Allows scaffolding of objects</li></ul><li>
Support for many to many relationships</li><li>
Dynamic data on MVC -- this is on codeplex today</li><li>
Built around something called field templates</li><li>
Enhanced filtering:</li><ul><li>
Auto-complete, search filters</li></ul></ul><p><b>ASP.NET Core</b></p><ul><li>
Address customer pain points</li><li>
Improve scale and performance</li><li>
Cache extensibility and performance:</li><ul><li>
Enable caching like Velocity</li></ul></ul><br /><p>
There's a couple of videos on Mircosoft's Channel 9 that talk specifically about the
points mentioned above:
</p><ul><li><a href="http://channel9.msdn.com/pdc2008/PC20/" rel="nofollow">ASP.NET 4.0 Roadmap</a> by
Scott Hunter</li><li><a href="http://channel9.msdn.com/shows/The%2BKnowledge%2BChamber/Stephen-Walther-New-Features-of-ASPNET-40/" rel="nofollow">New
Features of ASP.NET 4.0</a> by Steven Walther</li></ul><p></p><img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=a32cf09a-85ad-494f-874e-15d5c2348021" /></body>
      <title>New Features of .NET 4.0</title>
      <guid isPermaLink="false">http://ralphwhitbeck.com/PermaLink,guid,a32cf09a-85ad-494f-874e-15d5c2348021.aspx</guid>
      <link>http://ralphwhitbeck.com/2009/05/21/NewFeaturesOfNET40.aspx</link>
      <pubDate>Thu, 21 May 2009 19:19:48 GMT</pubDate>
      <description>Microsoft recently released &lt;a href="http://msdn.microsoft.com/en-us/netframework/dd819232.aspx"&gt;Visual
Studio 2010 and .NET 4.0 beta&lt;/a&gt;.&amp;nbsp; I'd like to highlight some of the key new
features available to .NET 4.0.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;b&gt;Web Forms&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Developers can manage control IDs that affect rendered client ID&lt;/li&gt;
&lt;li&gt;
Remove ID bloat, and 'mangling'&lt;/li&gt;
&lt;li&gt;
CSS: 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Ideally remove the need to use CSS adapters&lt;/li&gt;
&lt;li&gt;
Defer to CSS styles and bypass existing style properties&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
non-inline style attributes&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Support non-table-based HTML rendering&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
URL-routing for web forms&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Friendly url handling for web forms&lt;/li&gt;
&lt;li&gt;
configuration model for url routing&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
View state&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Disable on the page, enable on specific controls - they will provide granular control
of viewstate - today it is backwards&lt;/li&gt;
&lt;li&gt;
Disable on control, enable on child controls&lt;/li&gt;
&lt;li&gt;
GridView/ListView work better without viewstate&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
ASP.NET dynamic-data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;Ajax&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Continue ASP.NET Ajax innovation : RIA&lt;/li&gt;
&lt;li&gt;
Appeal to JavaScript Developers&lt;/li&gt;
&lt;li&gt;
Provide support for the page developer&lt;/li&gt;
&lt;li&gt;
jQuery including Intellisense&lt;/li&gt;
&lt;li&gt;
Templates and data binding&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Client side handling, REST or Web Services 
&lt;/li&gt;
&lt;li&gt;
Covers page developer and component developer scenarios&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
DOM manipulation, selectors ...&lt;/li&gt;
&lt;li&gt;
Ajax higher-level components&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Ajax Control Toolkit is a part of the strategy - they will make the toolkit part of
the overall ASP.NET package&lt;/li&gt;
&lt;li&gt;
New controls&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Centralized script libraries and break-up for performance&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;ASP.NET MVC&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Appeal to those wanting separation of concerns, TDD, full control&lt;/li&gt;
&lt;li&gt;
Ruby on Rails, Django, PHP&lt;/li&gt;
&lt;li&gt;
Building on from ASP.NET MVC 1.0&lt;/li&gt;
&lt;li&gt;
ASP.NET MVC (Model View Controller)&lt;/li&gt;
&lt;li&gt;
Asynchronous controllers&lt;/li&gt;
&lt;li&gt;
Sub-controllers &amp;amp; Views&lt;/li&gt;
&lt;li&gt;
Declarative controls&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;ASP.NET Dynamic Data&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Making building data-driven web apps easily&lt;/li&gt;
&lt;li&gt;
Attacking the Ruby on Rails crowd&lt;/li&gt;
&lt;li&gt;
Building on from FX3.5 SP1&lt;/li&gt;
&lt;li&gt;
Dynamic-data and MVC&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Scaffolding, templates and data validation&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Support for abstract data layer&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Removes need for specific DL (SQL, entities ...)&lt;/li&gt;
&lt;li&gt;
Allows scaffolding of objects&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Support for many to many relationships&lt;/li&gt;
&lt;li&gt;
Dynamic data on MVC -- this is on codeplex today&lt;/li&gt;
&lt;li&gt;
Built around something called field templates&lt;/li&gt;
&lt;li&gt;
Enhanced filtering:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Auto-complete, search filters&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;ASP.NET Core&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Address customer pain points&lt;/li&gt;
&lt;li&gt;
Improve scale and performance&lt;/li&gt;
&lt;li&gt;
Cache extensibility and performance:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Enable caching like Velocity&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;p&gt;
There's a couple of videos on Mircosoft's Channel 9 that talk specifically about the
points mentioned above:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://channel9.msdn.com/pdc2008/PC20/" rel="nofollow"&gt;ASP.NET 4.0 Roadmap&lt;/a&gt; by
Scott Hunter&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://channel9.msdn.com/shows/The%2BKnowledge%2BChamber/Stephen-Walther-New-Features-of-ASPNET-40/" rel="nofollow"&gt;New
Features of ASP.NET 4.0&lt;/a&gt; by Steven Walther&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=a32cf09a-85ad-494f-874e-15d5c2348021" /&gt;</description>
      <comments>http://ralphwhitbeck.com/CommentView,guid,a32cf09a-85ad-494f-874e-15d5c2348021.aspx</comments>
      <category>ASP.NET MVC;Interesting Links;Programming;Technology</category>
    </item>
    <item>
      <trackback:ping>http://ralphwhitbeck.com/Trackback.aspx?guid=5180f7aa-519c-4313-8f01-0b63a0bc61c2</trackback:ping>
      <pingback:server>http://ralphwhitbeck.com/pingback.aspx</pingback:server>
      <pingback:target>http://ralphwhitbeck.com/PermaLink,guid,5180f7aa-519c-4313-8f01-0b63a0bc61c2.aspx</pingback:target>
      <dc:creator>Ralph Whitbeck</dc:creator>
      <wfw:comment>http://ralphwhitbeck.com/CommentView,guid,5180f7aa-519c-4313-8f01-0b63a0bc61c2.aspx</wfw:comment>
      <wfw:commentRss>http://ralphwhitbeck.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5180f7aa-519c-4313-8f01-0b63a0bc61c2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">NETTUTS had a great tutorial by Dan Wellman
called "<a title="Building a jQuery-Powered Tag-Cloud" href="http://nettuts.com/tutorials/javascript-ajax/building-a-jquery-powered-tag-cloud/" id="zbuh">Building
a jQuery-Powered Tag-Cloud</a>" The problem for me was that the tutorial showed you
how to connect to the database and pull tags and frequencies via PHP.<br /><br />
Because I am currently learning ASP.NET MVC I thought I would try to duplicate the
results of the tutorial but with using ASP.NET MVC RC instread of PHP.  Here
is how I did it.<br /><br />
I started by creating a Home Controller class.<br /><br />
HomeController.cs<br /><br /><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span><span class="kwrd">using</span> System;</pre><pre><span class="lnum"> 2: </span><span class="kwrd">using</span> System.Collections.Generic;</pre><pre class="alt"><span class="lnum"> 3: </span><span class="kwrd">using</span> System.Linq;</pre><pre><span class="lnum"> 4: </span><span class="kwrd">using</span> System.Web;</pre><pre class="alt"><span class="lnum"> 5: </span><span class="kwrd">using</span> System.Web.Mvc;</pre><pre><span class="lnum"> 6: </span><span class="kwrd">using</span> System.Web.Mvc.Ajax;</pre><pre class="alt"><span class="lnum"> 7: </span> </pre><pre><span class="lnum"> 8: </span><span class="kwrd">namespace</span> MvcApplication5.Controllers</pre><pre class="alt"><span class="lnum"> 9: </span>{</pre><pre><span class="lnum"> 10: </span><span class="kwrd">public</span><span class="kwrd">class</span> HomeController
: Controller</pre><pre class="alt"><span class="lnum"> 11: </span> {</pre><pre><span class="lnum"> 12: </span><span class="rem">//</span></pre><pre class="alt"><span class="lnum"> 13: </span><span class="rem">// GET: /Home/</span></pre><pre><span class="lnum"> 14: </span><span class="kwrd">public</span> ActionResult
TagCloud()</pre><pre class="alt"><span class="lnum"> 15: </span> {</pre><pre><span class="lnum"> 16: </span><span class="kwrd">return</span> View();</pre><pre class="alt"><span class="lnum"> 17: </span> }</pre><pre><span class="lnum"> 18: </span> </pre><pre class="alt"><span class="lnum"> 19: </span><span class="kwrd">public</span> JsonResult
JSON()</pre><pre><span class="lnum"> 20: </span> {</pre><pre class="alt"><span class="lnum"> 21: </span> List&lt;<span class="kwrd">object</span>&gt;
tagcloud = <span class="kwrd">new</span> List&lt;<span class="kwrd">object</span>&gt;</pre><pre><span class="lnum"> 22: </span> {</pre><pre class="alt"><span class="lnum"> 23: </span><span class="kwrd">new</span> { tag
= <span class="str">"jQuery"</span>, freq = <span class="str">"10"</span> },</pre><pre><span class="lnum"> 24: </span><span class="kwrd">new</span> { tag = <span class="str">"asp.net"</span>,
freq = <span class="str">"3"</span>},</pre><pre class="alt"><span class="lnum"> 25: </span><span class="kwrd">new</span> { tag
= <span class="str">"programming"</span>, freq = <span class="str">"183"</span>},</pre><pre><span class="lnum"> 26: </span><span class="kwrd">new</span> { tag = <span class="str">"code"</span>,
freq = <span class="str">"34"</span> },</pre><pre class="alt"><span class="lnum"> 27: </span><span class="kwrd">new</span> { tag
= <span class="str">"HTML"</span>, freq = <span class="str">"58"</span>},</pre><pre><span class="lnum"> 28: </span><span class="kwrd">new</span> { tag = <span class="str">"javascript"</span>,
freq = <span class="str">"23"</span>},</pre><pre class="alt"><span class="lnum"> 29: </span><span class="kwrd">new</span> { tag
= <span class="str">"people"</span>, freq = <span class="str">"43"</span> },</pre><pre><span class="lnum"> 30: </span><span class="kwrd">new</span> { tag = <span class="str">"Google"</span>,
freq = <span class="str">"3"</span>},</pre><pre class="alt"><span class="lnum"> 31: </span><span class="kwrd">new</span> { tag
= <span class="str">"Microsoft"</span>, freq = <span class="str">"1"</span>},</pre><pre><span class="lnum"> 32: </span><span class="kwrd">new</span> { tag = <span class="str">"Apple"</span>,
freq = <span class="str">"10"</span> },</pre><pre class="alt"><span class="lnum"> 33: </span><span class="kwrd">new</span> { tag
= <span class="str">"iPhone"</span>, freq = <span class="str">"38"</span>},</pre><pre><span class="lnum"> 34: </span><span class="kwrd">new</span> { tag = <span class="str">"MVC"</span>,
freq = <span class="str">"1"</span>}</pre><pre class="alt"><span class="lnum"> 35: </span> };</pre><pre><span class="lnum"> 36: </span><span class="kwrd">return</span> Json(tagcloud); </pre><pre class="alt"><span class="lnum"> 37: </span> }</pre><pre><span class="lnum"> 38: </span> </pre><pre class="alt"><span class="lnum"> 39: </span> }</pre><pre><span class="lnum"> 40: </span>}</pre></div><br /><span> What's happening here is that we are making a action for the View we will create
and I am calling it TagCloud.  This action isn't going to provide us any data
so it's a stub action.  The next Action we create is to provide TagCloud the
JSON data.  In here I am creating a static List to send back serialized as JSON. 
You could also tie it to a model and use Linq to SQL to build the List. 
<br /><br />
Our URL for the .getJSON method will be: /Home/JSON 
<br /><br />
This will return JSON data that looks like this:<br /><br /></span><img src="http://ralphwhitbeck.com/content/binary/JSON-Data-ASPNET-MVC.png" border="0" /><span></span><span><br /><br />
Notice the difference in the JSON I am bringing back and the one Dan was bringing
back.  I don't have a tags: with the rest of the data nested under it. 
We'll need to update a line in the jQuery to make this work now.<br /><br />
Let's create the View for TagCloud.</span><br /><span><br />
TagCloud.aspx<br /><br /></span><!-- code formatted by http://manoli.net/csharpformat/ --><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style><div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span><span class="asp">&lt;%@ Page Language="C#"
Inherits="System.Web.Mvc.ViewPage" %&gt;</span></pre><pre><span class="lnum"> 2: </span> </pre><pre class="alt"><span class="lnum"> 3: </span><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span><span class="attr">HTML</span><span class="attr">PUBLIC</span><span class="kwrd">"-//W3C//DTD
HTML 4.01//EN"</span><span class="kwrd">"http://www.w3.org/TR/html4/strict.dtd"</span><span class="kwrd">&gt;</span></pre><pre><span class="lnum"> 4: </span><span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span></pre><pre class="alt"><span class="lnum"> 5: </span><span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span></pre><pre><span class="lnum"> 6: </span><span class="kwrd">&lt;</span><span class="html">link</span><span class="attr">rel</span><span class="kwrd">="stylesheet"</span><span class="attr">type</span><span class="kwrd">="text/css"</span><span class="attr">href</span><span class="kwrd">="/content/tagcloud.css"</span><span class="kwrd">/&gt;</span></pre><pre class="alt"><span class="lnum"> 7: </span><span class="kwrd">&lt;</span><span class="html">meta</span><span class="attr">http-equiv</span><span class="kwrd">="Content-Type"</span><span class="attr">content</span><span class="kwrd">="text/html;
charset=utf-8"</span><span class="kwrd">/&gt;</span></pre><pre><span class="lnum"> 8: </span><span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>jQuery
Tag Cloud<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span></pre><pre class="alt"><span class="lnum"> 9: </span><span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span></pre><pre><span class="lnum"> 10: </span><span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span></pre><pre class="alt"><span class="lnum"> 11: </span><span class="kwrd">&lt;</span><span class="html">div</span><span class="attr">id</span><span class="kwrd">="tagCloud"</span><span class="kwrd">&gt;</span></pre><pre><span class="lnum"> 12: </span><span class="kwrd">&lt;</span><span class="html">h2</span><span class="kwrd">&gt;</span>Tag
Cloud<span class="kwrd">&lt;/</span><span class="html">h2</span><span class="kwrd">&gt;</span></pre><pre class="alt"><span class="lnum"> 13: </span><span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre><pre><span class="lnum"> 14: </span><span class="kwrd">&lt;</span><span class="html">script</span><span class="attr">type</span><span class="kwrd">="text/javascript"</span><span class="attr">src</span><span class="kwrd">="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"</span><span class="kwrd">&gt;&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span></pre><pre class="alt"><span class="lnum"> 15: </span> &lt;script type=<span class="str">"text/javascript"</span>&gt;</pre><pre><span class="lnum"> 16: </span> $(<span class="kwrd">function</span>() {</pre><pre class="alt"><span class="lnum"> 17: </span><span class="rem">//get tag feed </span></pre><pre><span class="lnum"> 18: </span> $.getJSON(<span class="str">"/Home/JSON"</span>,<span class="kwrd">null</span>, <span class="kwrd">function</span>(data)
{</pre><pre class="alt"><span class="lnum"> 19: </span><span class="rem">//create list for
tag links </span></pre><pre><span class="lnum"> 20: </span> $(<span class="str">"&lt;ul&gt;"</span>).attr(<span class="str">"id"</span>, <span class="str">"tagList"</span>).appendTo(<span class="str">"#tagCloud"</span>);</pre><pre class="alt"><span class="lnum"> 21: </span> </pre><pre><span class="lnum"> 22: </span><span class="rem">//create tags </span></pre><pre class="alt"><span class="lnum"> 23: </span> $.each(data, <span class="kwrd">function</span>(i,
val) {</pre><pre><span class="lnum"> 24: </span> </pre><pre class="alt"><span class="lnum"> 25: </span><span class="rem">//create item </span></pre><pre><span class="lnum"> 26: </span><span class="kwrd">var</span> li = $(<span class="str">"&lt;li&gt;"</span>);</pre><pre class="alt"><span class="lnum"> 27: </span> </pre><pre><span class="lnum"> 28: </span><span class="rem">//create link </span></pre><pre class="alt"><span class="lnum"> 29: </span> $(<span class="str">"&lt;a&gt;"</span>).text(val.tag).attr({
title: <span class="str">"See all pages tagged with "</span> + val.tag, href: <span class="str">"http://localhost/tags/"</span> +
val.tag + <span class="str">".html"</span> }).appendTo(li);</pre><pre><span class="lnum"> 30: </span> </pre><pre class="alt"><span class="lnum"> 31: </span><span class="rem">//add to list</span></pre><pre><span class="lnum"> 32: </span> li.appendTo(<span class="str">"#tagList"</span>);</pre><pre class="alt"><span class="lnum"> 33: </span><span class="rem">//set tag size </span></pre><pre><span class="lnum"> 34: </span> li.children().css(<span class="str">"fontSize"</span>,
(val.freq / 10 &lt; 1) ? val.freq / 10 + 1 + <span class="str">"em"</span> : (val.freq
/ 10 &gt; 2) ? <span class="str">"2em"</span> : val.freq / 10 + <span class="str">"em"</span>); </pre><pre class="alt"><span class="lnum"> 35: </span></pre><pre><span class="lnum"> 36: </span> });</pre><pre class="alt"><span class="lnum"> 37: </span> });</pre><pre><span class="lnum"> 38: </span> }); </pre><pre class="alt"><span class="lnum"> 39: </span><span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span></pre><pre><span class="lnum"> 40: </span><span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span></pre><pre class="alt"><span class="lnum"> 41: </span><span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre></div><br /><span>As we start to loop through the JSON data Dan was telling jQuery to start inside
tags with data.tags, since we don't have tags we can just use the variable data like
so: </span><span>$.each(data, function(i, val) {<br /><br />
The rest of setting this up is the same as NETTUTS article.  All that remains
is the css.<br /><br /></span><img src="http://ralphwhitbeck.com/content/binary/tagcloud-preview.png" border="0" /><br /><br /><br /><b>Download the Source</b><br /><br /><a href="http://ralphwhitbeck.com/content/binary/jQuery-TagCloud_source.zip">jQuery-TagCloud_source.zip
(44.82 KB)</a><br /><br /><br /><br /><img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=5180f7aa-519c-4313-8f01-0b63a0bc61c2" /></body>
      <title>Building a jQuery-Powered Tag-Cloud with an ASP.NET MVC backend</title>
      <guid isPermaLink="false">http://ralphwhitbeck.com/PermaLink,guid,5180f7aa-519c-4313-8f01-0b63a0bc61c2.aspx</guid>
      <link>http://ralphwhitbeck.com/2009/01/30/BuildingAJQueryPoweredTagCloudWithAnASPNETMVCBackend.aspx</link>
      <pubDate>Fri, 30 Jan 2009 04:02:13 GMT</pubDate>
      <description>NETTUTS had a great tutorial by Dan Wellman called "&lt;a title="Building a jQuery-Powered Tag-Cloud" href="http://nettuts.com/tutorials/javascript-ajax/building-a-jquery-powered-tag-cloud/" id="zbuh"&gt;Building
a jQuery-Powered Tag-Cloud&lt;/a&gt;" The problem for me was that the tutorial showed you
how to connect to the database and pull tags and frequencies via PHP.&lt;br&gt;
&lt;br&gt;
Because I am currently learning ASP.NET MVC I thought I would try to duplicate the
results of the tutorial but with using ASP.NET MVC RC instread of PHP.&amp;nbsp; Here
is how I did it.&lt;br&gt;
&lt;br&gt;
I started by creating a Home Controller class.&lt;br&gt;
&lt;br&gt;
HomeController.cs&lt;br&gt;
&lt;br&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Mvc.Ajax;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; MvcApplication5.Controllers&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; HomeController
: Controller&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; &lt;span class="rem"&gt;//&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; &lt;span class="rem"&gt;// GET: /Home/&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult
TagCloud()&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; JsonResult
JSON()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;
tagcloud = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag
= &lt;span class="str"&gt;"jQuery"&lt;/span&gt;, freq = &lt;span class="str"&gt;"10"&lt;/span&gt; },&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag = &lt;span class="str"&gt;"asp.net"&lt;/span&gt;,
freq = &lt;span class="str"&gt;"3"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag
= &lt;span class="str"&gt;"programming"&lt;/span&gt;, freq = &lt;span class="str"&gt;"183"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag = &lt;span class="str"&gt;"code"&lt;/span&gt;,
freq = &lt;span class="str"&gt;"34"&lt;/span&gt; },&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag
= &lt;span class="str"&gt;"HTML"&lt;/span&gt;, freq = &lt;span class="str"&gt;"58"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag = &lt;span class="str"&gt;"javascript"&lt;/span&gt;,
freq = &lt;span class="str"&gt;"23"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 29: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag
= &lt;span class="str"&gt;"people"&lt;/span&gt;, freq = &lt;span class="str"&gt;"43"&lt;/span&gt; },&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 30: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag = &lt;span class="str"&gt;"Google"&lt;/span&gt;,
freq = &lt;span class="str"&gt;"3"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 31: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag
= &lt;span class="str"&gt;"Microsoft"&lt;/span&gt;, freq = &lt;span class="str"&gt;"1"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 32: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag = &lt;span class="str"&gt;"Apple"&lt;/span&gt;,
freq = &lt;span class="str"&gt;"10"&lt;/span&gt; },&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 33: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag
= &lt;span class="str"&gt;"iPhone"&lt;/span&gt;, freq = &lt;span class="str"&gt;"38"&lt;/span&gt;},&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 34: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { tag = &lt;span class="str"&gt;"MVC"&lt;/span&gt;,
freq = &lt;span class="str"&gt;"1"&lt;/span&gt;}&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 35: &lt;/span&gt; };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 36: &lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; Json(tagcloud); &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 37: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 38: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 39: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 40: &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;span&gt; What's happening here is that we are making a action for the View we will create
and I am calling it TagCloud.&amp;nbsp; This action isn't going to provide us any data
so it's a stub action.&amp;nbsp; The next Action we create is to provide TagCloud the
JSON data.&amp;nbsp; In here I am creating a static List to send back serialized as JSON.&amp;nbsp;
You could also tie it to a model and use Linq to SQL to build the List. 
&lt;br&gt;
&lt;br&gt;
Our URL for the .getJSON method will be: /Home/JSON 
&lt;br&gt;
&lt;br&gt;
This will return JSON data that looks like this:&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;img src="http://ralphwhitbeck.com/content/binary/JSON-Data-ASPNET-MVC.png" border="0"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;
&lt;br&gt;
&lt;br&gt;
Notice the difference in the JSON I am bringing back and the one Dan was bringing
back.&amp;nbsp; I don't have a tags: with the rest of the data nested under it.&amp;nbsp;
We'll need to update a line in the jQuery to make this work now.&lt;br&gt;
&lt;br&gt;
Let's create the View for TagCloud.&lt;/span&gt;
&lt;br&gt;
&lt;span&gt; 
&lt;br&gt;
TagCloud.aspx&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="asp"&gt;&amp;lt;%@ Page Language="C#"
Inherits="System.Web.Mvc.ViewPage" %&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="html"&gt;DOCTYPE&lt;/span&gt; &lt;span class="attr"&gt;HTML&lt;/span&gt; &lt;span class="attr"&gt;PUBLIC&lt;/span&gt; &lt;span class="kwrd"&gt;"-//W3C//DTD
HTML 4.01//EN"&lt;/span&gt; &lt;span class="kwrd"&gt;"http://www.w3.org/TR/html4/strict.dtd"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt; &lt;span class="attr"&gt;rel&lt;/span&gt;&lt;span class="kwrd"&gt;="stylesheet"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/css"&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="/content/tagcloud.css"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;meta&lt;/span&gt; &lt;span class="attr"&gt;http-equiv&lt;/span&gt;&lt;span class="kwrd"&gt;="Content-Type"&lt;/span&gt; &lt;span class="attr"&gt;content&lt;/span&gt;&lt;span class="kwrd"&gt;="text/html;
charset=utf-8"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;jQuery
Tag Cloud&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="tagCloud"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;h2&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Tag
Cloud&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;h2&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; &amp;lt;script type=&lt;span class="str"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt; $(&lt;span class="kwrd"&gt;function&lt;/span&gt;() {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; &lt;span class="rem"&gt;//get tag feed &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt; $.getJSON(&lt;span class="str"&gt;"/Home/JSON"&lt;/span&gt;,&lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(data)
{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt; &lt;span class="rem"&gt;//create list for
tag links &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt; $(&lt;span class="str"&gt;"&amp;lt;ul&amp;gt;"&lt;/span&gt;).attr(&lt;span class="str"&gt;"id"&lt;/span&gt;, &lt;span class="str"&gt;"tagList"&lt;/span&gt;).appendTo(&lt;span class="str"&gt;"#tagCloud"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt; &lt;span class="rem"&gt;//create tags &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt; $.each(data, &lt;span class="kwrd"&gt;function&lt;/span&gt;(i,
val) {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt; &lt;span class="rem"&gt;//create item &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt; &lt;span class="kwrd"&gt;var&lt;/span&gt; li = $(&lt;span class="str"&gt;"&amp;lt;li&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt; &lt;span class="rem"&gt;//create link &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 29: &lt;/span&gt; $(&lt;span class="str"&gt;"&amp;lt;a&amp;gt;"&lt;/span&gt;).text(val.tag).attr({
title: &lt;span class="str"&gt;"See all pages tagged with "&lt;/span&gt; + val.tag, href: &lt;span class="str"&gt;"http://localhost/tags/"&lt;/span&gt; +
val.tag + &lt;span class="str"&gt;".html"&lt;/span&gt; }).appendTo(li);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 30: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 31: &lt;/span&gt; &lt;span class="rem"&gt;//add to list&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 32: &lt;/span&gt; li.appendTo(&lt;span class="str"&gt;"#tagList"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 33: &lt;/span&gt; &lt;span class="rem"&gt;//set tag size &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 34: &lt;/span&gt; li.children().css(&lt;span class="str"&gt;"fontSize"&lt;/span&gt;,
(val.freq / 10 &amp;lt; 1) ? val.freq / 10 + 1 + &lt;span class="str"&gt;"em"&lt;/span&gt; : (val.freq
/ 10 &amp;gt; 2) ? &lt;span class="str"&gt;"2em"&lt;/span&gt; : val.freq / 10 + &lt;span class="str"&gt;"em"&lt;/span&gt;); &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 35: &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 36: &lt;/span&gt; });&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 37: &lt;/span&gt; });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 38: &lt;/span&gt; }); &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 39: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 40: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 41: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;span&gt;As we start to loop through the JSON data Dan was telling jQuery to start inside
tags with data.tags, since we don't have tags we can just use the variable data like
so: &lt;/span&gt;&lt;span&gt;$.each(data, function(i, val) {&lt;br&gt;
&lt;br&gt;
The rest of setting this up is the same as NETTUTS article.&amp;nbsp; All that remains
is the css.&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;img src="http://ralphwhitbeck.com/content/binary/tagcloud-preview.png" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Download the Source&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://ralphwhitbeck.com/content/binary/jQuery-TagCloud_source.zip"&gt;jQuery-TagCloud_source.zip
(44.82 KB)&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=5180f7aa-519c-4313-8f01-0b63a0bc61c2" /&gt;</description>
      <comments>http://ralphwhitbeck.com/CommentView,guid,5180f7aa-519c-4313-8f01-0b63a0bc61c2.aspx</comments>
      <category>ASP.NET MVC;How-to;jQuery;Programming;Technology</category>
    </item>
    <item>
      <trackback:ping>http://ralphwhitbeck.com/Trackback.aspx?guid=0167cccc-95ee-493f-84cf-d144a644bbfe</trackback:ping>
      <pingback:server>http://ralphwhitbeck.com/pingback.aspx</pingback:server>
      <pingback:target>http://ralphwhitbeck.com/PermaLink,guid,0167cccc-95ee-493f-84cf-d144a644bbfe.aspx</pingback:target>
      <dc:creator>Ralph Whitbeck</dc:creator>
      <wfw:comment>http://ralphwhitbeck.com/CommentView,guid,0167cccc-95ee-493f-84cf-d144a644bbfe.aspx</wfw:comment>
      <wfw:commentRss>http://ralphwhitbeck.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0167cccc-95ee-493f-84cf-d144a644bbfe</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Check out<a href="http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx"> Scott
Guthrie's mammoth blog post</a> on what's changed in this release of the <a href="http://go.microsoft.com/fwlink/?LinkID=141184&amp;clcid=0x409">ASP.NET
MVC RC</a> that was pushed to the public today.  A lot has changed in my opinion. 
One change that I wasn't expecting was that Views and View User Controls do not have
code-behinds any more. 
<br /><br />
The problem was the only way to have strongly typed Views was to inherit in the code
behind.  This caused an issue with intellisense in the aspx/ascx pages. You would
need to create and immediately build in order to have intellisense work. 
<br /><br />
No one was using the code-behinds anyways.  The code should be in the Controllers.<br /><br />
Here is the write up from Scotts Blog:<br /><br /><blockquote><font size="2" face="arial"><p><u>Views without Code-Behind Files</u></p><p>
Based on feedback we’ve changed view-templates to not have a code-behind file by default. 
This change helps reinforce the purpose of views in a MVC application (which are intended
to be purely about rendering and to not contain any non-rendering related code), and
for most people eliminates unused files in the project.
</p><p>
The RC build now adds C# and VB syntax support for inheriting view templates from
base classes that use generics.  For example, below we are using this with the
Edit.aspx view template – whose “inherits” attribute derives from the ViewPage&lt;Product&gt;
type:
</p><p><img src="http://www.scottgu.com/blogposts/mvcrc/mvcrc/step22.png" /></p><p>
One nice benefit of not using a code-behind file is that you'll now get immediate
intellisense within view template files when you add them to the project.  With
previous builds you had to do a build/compile immediately after creating a view in
order to get code intellisense within it.  The RC makes the workflow of adding
and immediately editing a view compile-free and much more seamless.
</p><p><em>Important: If you are upgrading a ASP.NET MVC project that was created with an
earlier build make sure to follow the steps in the release notes – the web.config
file under the \Views directory needs to be updated with some settings in order for
the above generics based syntax to work.</em></p></font></blockquote><p></p><img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=0167cccc-95ee-493f-84cf-d144a644bbfe" /></body>
      <title>ASP.NET MVC Release Candidate - No Codebehinds on Views</title>
      <guid isPermaLink="false">http://ralphwhitbeck.com/PermaLink,guid,0167cccc-95ee-493f-84cf-d144a644bbfe.aspx</guid>
      <link>http://ralphwhitbeck.com/2009/01/28/ASPNETMVCReleaseCandidateNoCodebehindsOnViews.aspx</link>
      <pubDate>Wed, 28 Jan 2009 05:55:32 GMT</pubDate>
      <description>Check out&lt;a href="http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx"&gt; Scott
Guthrie's mammoth blog post&lt;/a&gt; on what's changed in this release of the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=141184&amp;amp;clcid=0x409"&gt;ASP.NET
MVC RC&lt;/a&gt; that was pushed to the public today.&amp;nbsp; A lot has changed in my opinion.&amp;nbsp;
One change that I wasn't expecting was that Views and View User Controls do not have
code-behinds any more. 
&lt;br&gt;
&lt;br&gt;
The problem was the only way to have strongly typed Views was to inherit in the code
behind.&amp;nbsp; This caused an issue with intellisense in the aspx/ascx pages. You would
need to create and immediately build in order to have intellisense work. 
&lt;br&gt;
&lt;br&gt;
No one was using the code-behinds anyways.&amp;nbsp; The code should be in the Controllers.&lt;br&gt;
&lt;br&gt;
Here is the write up from Scotts Blog:&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;font size="2" face="arial"&gt;
&lt;p&gt;
&lt;u&gt;Views without Code-Behind Files&lt;/u&gt;
&lt;/p&gt;
&lt;p&gt;
Based on feedback we’ve changed view-templates to not have a code-behind file by default.&amp;nbsp;
This change helps reinforce the purpose of views in a MVC application (which are intended
to be purely about rendering and to not contain any non-rendering related code), and
for most people eliminates unused files in the project.
&lt;/p&gt;
&lt;p&gt;
The RC build now adds C# and VB syntax support for inheriting view templates from
base classes that use generics.&amp;nbsp; For example, below we are using this with the
Edit.aspx view template – whose “inherits” attribute derives from the ViewPage&amp;lt;Product&amp;gt;
type:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.scottgu.com/blogposts/mvcrc/mvcrc/step22.png"&gt; 
&lt;/p&gt;
&lt;p&gt;
One nice benefit of not using a code-behind file is that you'll now get immediate
intellisense within view template files when you add them to the project.&amp;nbsp; With
previous builds you had to do a build/compile immediately after creating a view in
order to get code intellisense within it.&amp;nbsp; The RC makes the workflow of adding
and immediately editing a view compile-free and much more seamless.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Important: If you are upgrading a ASP.NET MVC project that was created with an
earlier build make sure to follow the steps in the release notes – the web.config
file under the \Views directory needs to be updated with some settings in order for
the above generics based syntax to work.&lt;/em&gt;
&lt;/p&gt;
&lt;/font&gt;&lt;/blockquote&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=0167cccc-95ee-493f-84cf-d144a644bbfe" /&gt;</description>
      <comments>http://ralphwhitbeck.com/CommentView,guid,0167cccc-95ee-493f-84cf-d144a644bbfe.aspx</comments>
      <category>ASP.NET MVC;Interesting Links;Programming;Technology</category>
    </item>
    <item>
      <trackback:ping>http://ralphwhitbeck.com/Trackback.aspx?guid=e11e89e2-29bf-4560-9a8f-459d35fba465</trackback:ping>
      <pingback:server>http://ralphwhitbeck.com/pingback.aspx</pingback:server>
      <pingback:target>http://ralphwhitbeck.com/PermaLink,guid,e11e89e2-29bf-4560-9a8f-459d35fba465.aspx</pingback:target>
      <dc:creator>Ralph Whitbeck</dc:creator>
      <wfw:comment>http://ralphwhitbeck.com/CommentView,guid,e11e89e2-29bf-4560-9a8f-459d35fba465.aspx</wfw:comment>
      <wfw:commentRss>http://ralphwhitbeck.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e11e89e2-29bf-4560-9a8f-459d35fba465</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">BarCamp Rochester 4 has been announced
for April 18th at RIT.  I missed last years and wish I could of attended. 
This year I kicked myself in the butt and signed up to present on ASP.NET MVC. 
This will force me to do a couple of things.  It'll force me to really understand
MVC and it'll force me to be prepared.<br /><br />
Now if it'll force me to rewrite my blog in ASP.NET MVC by then who knows. Would be
a good talking point. 
<br /><br />
Anyway, here is an initial structure of my presentation I am thinking about:<br /><br /><ul><li>
Introduction</li><li>
MVC</li><ul><li>
Current uses (ruby on rails, CakePHP, etc.)</li><li>
MVC in the wild (StackOverflow)</li><li>
Status of MVC<br /></li></ul><li>
MVC vs Web Forms</li><li>
Demo (perhaps build a simple blog)</li></ul>
Any suggestions?<br /><p></p><img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=e11e89e2-29bf-4560-9a8f-459d35fba465" /></body>
      <title>BarCamp Rochester 4</title>
      <guid isPermaLink="false">http://ralphwhitbeck.com/PermaLink,guid,e11e89e2-29bf-4560-9a8f-459d35fba465.aspx</guid>
      <link>http://ralphwhitbeck.com/2009/01/26/BarCampRochester4.aspx</link>
      <pubDate>Mon, 26 Jan 2009 16:00:23 GMT</pubDate>
      <description>BarCamp Rochester 4 has been announced for April 18th at RIT.&amp;nbsp; I missed last years and wish I could of attended.&amp;nbsp; This year I kicked myself in the butt and signed up to present on ASP.NET MVC.&amp;nbsp; This will force me to do a couple of things.&amp;nbsp; It'll force me to really understand MVC and it'll force me to be prepared.&lt;br&gt;
&lt;br&gt;
Now if it'll force me to rewrite my blog in ASP.NET MVC by then who knows. Would be
a good talking point. 
&lt;br&gt;
&lt;br&gt;
Anyway, here is an initial structure of my presentation I am thinking about:&lt;br&gt;
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
Introduction&lt;/li&gt;
&lt;li&gt;
MVC&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Current uses (ruby on rails, CakePHP, etc.)&lt;/li&gt;
&lt;li&gt;
MVC in the wild (StackOverflow)&lt;/li&gt;
&lt;li&gt;
Status of MVC&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
MVC vs Web Forms&lt;/li&gt;
&lt;li&gt;
Demo (perhaps build a simple blog)&lt;/li&gt;
&lt;/ul&gt;
Any suggestions?&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://ralphwhitbeck.com/aggbug.ashx?id=e11e89e2-29bf-4560-9a8f-459d35fba465" /&gt;</description>
      <comments>http://ralphwhitbeck.com/CommentView,guid,e11e89e2-29bf-4560-9a8f-459d35fba465.aspx</comments>
      <category>Programming;Technology;ASP.NET MVC</category>
    </item>
  </channel>
</rss>