<?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>The Wit and Ramblings of David Giard - ASP.NET</title>
    <link>http://www.davidgiard.com/</link>
    <description>Demanding rigidly defined areas of doubt and uncertainty</description>
    <language>en-us</language>
    <copyright>David Giard</copyright>
    <lastBuildDate>Wed, 13 Mar 2013 17:14:15 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>davidgiard@davidgiard.com</managingEditor>
    <webMaster>davidgiard@davidgiard.com</webMaster>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=9a212b0a-2429-43d9-a7d4-2a757055f323</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,9a212b0a-2429-43d9-a7d4-2a757055f323.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,9a212b0a-2429-43d9-a7d4-2a757055f323.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9a212b0a-2429-43d9-a7d4-2a757055f323</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" />
        </p>
        <p>
          <strong>Episode 256</strong>
        </p>
        <p>
          <a href="http://technologyandfriends.com/SubText/archive/2013/03/11/tf256.aspx" target="_blank"> Mark
Dunn on ASP.NET MVC 4 Mobile Views </a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=9a212b0a-2429-43d9-a7d4-2a757055f323" />
      </body>
      <title>Mark Dunn on ASP.NET MVC 4 Mobile Views</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,9a212b0a-2429-43d9-a7d4-2a757055f323.aspx</guid>
      <link>http://www.davidgiard.com/2013/03/13/MarkDunnOnASPNETMVC4MobileViews.aspx</link>
      <pubDate>Wed, 13 Mar 2013 17:14:15 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 256&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://technologyandfriends.com/SubText/archive/2013/03/11/tf256.aspx" target="_blank"&gt; Mark
Dunn on ASP.NET MVC 4 Mobile Views &lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=9a212b0a-2429-43d9-a7d4-2a757055f323" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,9a212b0a-2429-43d9-a7d4-2a757055f323.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
      <category>Technology and Friends</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=860134cc-89c0-4e87-8e0b-f9f7c24561d7</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,860134cc-89c0-4e87-8e0b-f9f7c24561d7.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,860134cc-89c0-4e87-8e0b-f9f7c24561d7.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=860134cc-89c0-4e87-8e0b-f9f7c24561d7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" />
        </p>
        <p>
          <strong>Episode 233</strong>
        </p>
        <p>
          <a href="http://technologyandfriends.com/SubText/archive/2012/10/08/tf233.aspx" target="_blank"> Jay
Harris on MVC View Engines </a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=860134cc-89c0-4e87-8e0b-f9f7c24561d7" />
      </body>
      <title>Jay Harris on MVC View Engines</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,860134cc-89c0-4e87-8e0b-f9f7c24561d7.aspx</guid>
      <link>http://www.davidgiard.com/2012/10/08/JayHarrisOnMVCViewEngines.aspx</link>
      <pubDate>Mon, 08 Oct 2012 11:23:01 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 233&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://technologyandfriends.com/SubText/archive/2012/10/08/tf233.aspx" target="_blank"&gt; Jay
Harris on MVC View Engines &lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=860134cc-89c0-4e87-8e0b-f9f7c24561d7" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,860134cc-89c0-4e87-8e0b-f9f7c24561d7.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
      <category>Technology and Friends</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=69ac98d1-90b8-4e4b-8fe8-af4232baebf6</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,69ac98d1-90b8-4e4b-8fe8-af4232baebf6.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,69ac98d1-90b8-4e4b-8fe8-af4232baebf6.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=69ac98d1-90b8-4e4b-8fe8-af4232baebf6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" />
        </p>
        <p>
          <strong>Episode 226</strong>
        </p>
        <p>
          <a href="http://technologyandfriends.com/SubText/archive/2012/08/20/tf226.aspx" target="_blank">Scott
Hanselman on Visual Studio 2012</a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=69ac98d1-90b8-4e4b-8fe8-af4232baebf6" />
      </body>
      <title>Scott Hanselman on Visual Studio 2012</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,69ac98d1-90b8-4e4b-8fe8-af4232baebf6.aspx</guid>
      <link>http://www.davidgiard.com/2012/08/21/ScottHanselmanOnVisualStudio2012.aspx</link>
      <pubDate>Tue, 21 Aug 2012 03:27:41 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 226&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://technologyandfriends.com/SubText/archive/2012/08/20/tf226.aspx" target="_blank"&gt;Scott
Hanselman on Visual Studio 2012&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=69ac98d1-90b8-4e4b-8fe8-af4232baebf6" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,69ac98d1-90b8-4e4b-8fe8-af4232baebf6.aspx</comments>
      <category>.Net</category>
      <category>ASP.NET</category>
      <category>Video</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yesterday, I had the pleasure of presenting at the <a href="http://aspconf.net" target="_blank">aspconf</a> online
conference. I delivered 2 presentations: HTML5 is the <em>Future of the Web</em>;
and <em>Using Windows Azure Storage</em>.
</p>
        <p>
As promised, my slides and demos are available by clicking the links below.
</p>
        <div>
          <iframe height="120" src="https://skydrive.live.com/embed?cid=7048EC40C0AC24C1&amp;resid=7048EC40C0AC24C1%21749&amp;authkey=ADA8J0qZ1ojBqos" frameborder="0" width="98" scrolling="no">
          </iframe>
    
<iframe height="120" src="https://skydrive.live.com/embed?cid=7048EC40C0AC24C1&amp;resid=7048EC40C0AC24C1%21750&amp;authkey=ANmUwjbhZdq96kU" frameborder="0" width="98" scrolling="no"></iframe></div>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72" />
      </body>
      <title>aspConf Demos and Slides</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72.aspx</guid>
      <link>http://www.davidgiard.com/2012/07/18/aspConfDemosAndSlides.aspx</link>
      <pubDate>Wed, 18 Jul 2012 14:43:00 GMT</pubDate>
      <description>&lt;p&gt;
Yesterday, I had the pleasure of presenting at the &lt;a href="http://aspconf.net" target="_blank"&gt;aspconf&lt;/a&gt; online
conference. I delivered 2 presentations: HTML5 is the &lt;em&gt;Future of the Web&lt;/em&gt;;
and &lt;em&gt;Using Windows Azure Storage&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
As promised, my slides and demos are available by clicking the links below.
&lt;/p&gt;
&lt;div&gt;
&lt;iframe height="120" src="https://skydrive.live.com/embed?cid=7048EC40C0AC24C1&amp;amp;resid=7048EC40C0AC24C1%21749&amp;amp;authkey=ADA8J0qZ1ojBqos" frameborder="0" width="98" scrolling="no"&gt;
&lt;/iframe&gt;
&amp;#160;&amp;#160;&amp;#160; 
&lt;iframe height="120" src="https://skydrive.live.com/embed?cid=7048EC40C0AC24C1&amp;amp;resid=7048EC40C0AC24C1%21750&amp;amp;authkey=ANmUwjbhZdq96kU" frameborder="0" width="98" scrolling="no"&gt;
&lt;/iframe&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,ce5f76a7-89c0-47b5-bfbc-c5b485aeaa72.aspx</comments>
      <category>ASP.NET</category>
      <category>Azure</category>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" />
        </p>
        <p>
          <strong>Episode 207</strong>
        </p>
        <p>
          <a href="http://technologyandfriends.com/SubText/archive/2012/04/23/tf207.aspx" target="_blank">Troy
Hunt on ASP.NET Security </a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de" />
      </body>
      <title>Troy Hunt on ASP.NET Security</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de.aspx</guid>
      <link>http://www.davidgiard.com/2012/04/23/TroyHuntOnASPNETSecurity.aspx</link>
      <pubDate>Mon, 23 Apr 2012 20:37:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 207&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://technologyandfriends.com/SubText/archive/2012/04/23/tf207.aspx" target="_blank"&gt;Troy
Hunt on ASP.NET Security &lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,626cd51b-7ac2-49f3-bc5b-6e32f0e7b9de.aspx</comments>
      <category>ASP.NET</category>
      <category>Security</category>
      <category>Technology and Friends</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=ef6382fb-6494-4dad-a948-531fb03df08d</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,ef6382fb-6494-4dad-a948-531fb03df08d.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,ef6382fb-6494-4dad-a948-531fb03df08d.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ef6382fb-6494-4dad-a948-531fb03df08d</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" />
        </p>
        <p>
          <strong>Episode 184</strong>
        </p>
        <p>
          <a href="http://technologyandfriends.com/SubText/archive/2011/11/28/tf184.aspx" target="_blank">Scott
Hunter on ASP.NET 4.5</a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ef6382fb-6494-4dad-a948-531fb03df08d" />
      </body>
      <title>Scott Hunter on ASP.NET 4.5</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,ef6382fb-6494-4dad-a948-531fb03df08d.aspx</guid>
      <link>http://www.davidgiard.com/2011/11/28/ScottHunterOnASPNET45.aspx</link>
      <pubDate>Mon, 28 Nov 2011 16:14:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 184&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://technologyandfriends.com/SubText/archive/2011/11/28/tf184.aspx" target="_blank"&gt;Scott
Hunter on ASP.NET 4.5&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ef6382fb-6494-4dad-a948-531fb03df08d" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,ef6382fb-6494-4dad-a948-531fb03df08d.aspx</comments>
      <category>ASP.NET</category>
      <category>Technology and Friends</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=fc603bf7-00a2-40a6-afe7-d6017e7b0d3f</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,fc603bf7-00a2-40a6-afe7-d6017e7b0d3f.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,fc603bf7-00a2-40a6-afe7-d6017e7b0d3f.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=fc603bf7-00a2-40a6-afe7-d6017e7b0d3f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /> 
</p>
        <p>
          <strong>Episode 135</strong>
        </p>
        <p>
          <a href="xhttp://technologyandfriends.com/TechnologyAndFriends/SubText/archive/2011/02/07/tf135.aspx" target="_blank">Shaun
Walker and Joe Brinkman on DNN and Razor</a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=fc603bf7-00a2-40a6-afe7-d6017e7b0d3f" />
      </body>
      <title>Shaun Walker and Joe Brinkman on DNN and Razor</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,fc603bf7-00a2-40a6-afe7-d6017e7b0d3f.aspx</guid>
      <link>http://www.davidgiard.com/2011/02/07/ShaunWalkerAndJoeBrinkmanOnDNNAndRazor.aspx</link>
      <pubDate>Mon, 07 Feb 2011 13:35:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" /&gt;&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 135&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="xhttp://technologyandfriends.com/TechnologyAndFriends/SubText/archive/2011/02/07/tf135.aspx" target="_blank"&gt;Shaun
Walker and Joe Brinkman on DNN and Razor&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=fc603bf7-00a2-40a6-afe7-d6017e7b0d3f" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,fc603bf7-00a2-40a6-afe7-d6017e7b0d3f.aspx</comments>
      <category>ASP.NET</category>
      <category>Technology and Friends</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=ce2f1110-b0a4-4e96-9c0b-9643ea84478f</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,ce2f1110-b0a4-4e96-9c0b-9643ea84478f.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,ce2f1110-b0a4-4e96-9c0b-9643ea84478f.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ce2f1110-b0a4-4e96-9c0b-9643ea84478f</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img src="content/binary/TechnologyAndFriends.gif" border="0" />
        </p>
        <p>
          <strong>Episode 106</strong>
        </p>
        <p>
          <a href="http://technologyandfriends.com/archive/2010/08/02/tf106.aspx">J Wynia on
Spark View Engine</a>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ce2f1110-b0a4-4e96-9c0b-9643ea84478f" />
      </body>
      <title>J Wynia on Spark View Engine</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,ce2f1110-b0a4-4e96-9c0b-9643ea84478f.aspx</guid>
      <link>http://www.davidgiard.com/2010/08/02/JWyniaOnSparkViewEngine.aspx</link>
      <pubDate>Mon, 02 Aug 2010 12:23:42 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img src="content/binary/TechnologyAndFriends.gif" border="0"&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 106&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://technologyandfriends.com/archive/2010/08/02/tf106.aspx"&gt;J Wynia on
Spark View Engine&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ce2f1110-b0a4-4e96-9c0b-9643ea84478f" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,ce2f1110-b0a4-4e96-9c0b-9643ea84478f.aspx</comments>
      <category>ASP.NET</category>
      <category>Interviews</category>
      <category>Technology and Friends</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=d08885a8-529c-446a-920a-1a721f0c2dfc</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,d08885a8-529c-446a-920a-1a721f0c2dfc.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,d08885a8-529c-446a-920a-1a721f0c2dfc.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d08885a8-529c-446a-920a-1a721f0c2dfc</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img border="0" src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" />
        </p>
        <p>
          <strong>Episode 65</strong>
        </p>
        <p>
Wrox just released a new book 'Testing ASP.Net web applications' by Jeff McWherter
and Ben Hall. In this interview, Jeff and Ben discuss the importance of testing, the
different types of tests and how to effectively test your web application.
</p>
        <object height="370" width="437" id="viddler_51334f16" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
          <param value="http://www.viddler.com/player/51334f16/" name="movie" />
          <param value="always" name="allowScriptAccess" />
          <param value="true" name="allowFullScreen" />
          <embed height="370" width="437" name="viddler_51334f16" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" src="http://www.viddler.com/player/51334f16/">
          </embed>
        </object>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=d08885a8-529c-446a-920a-1a721f0c2dfc" />
      </body>
      <title>Jeff McWherter and Ben Hall on Testing</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,d08885a8-529c-446a-920a-1a721f0c2dfc.aspx</guid>
      <link>http://www.davidgiard.com/2010/01/25/JeffMcWherterAndBenHallOnTesting.aspx</link>
      <pubDate>Mon, 25 Jan 2010 05:04:09 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img border=0 src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif"&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 65&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Wrox just released a new book 'Testing ASP.Net web applications' by Jeff McWherter
and Ben Hall. In this interview, Jeff and Ben discuss the importance of testing, the
different types of tests and how to effectively test your web application.
&lt;/p&gt;
&lt;object height="370" width="437" id="viddler_51334f16" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;
&lt;param value="http://www.viddler.com/player/51334f16/" name="movie" /&gt;
&lt;param value="always" name="allowScriptAccess" /&gt;
&lt;param value="true" name="allowFullScreen" /&gt;
&lt;embed height="370" width="437" name="viddler_51334f16" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" src="http://www.viddler.com/player/51334f16/"&gt;&lt;/embed&gt;
&lt;/object&gt;&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=d08885a8-529c-446a-920a-1a721f0c2dfc" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,d08885a8-529c-446a-920a-1a721f0c2dfc.aspx</comments>
      <category>ASP.NET</category>
      <category>Interviews</category>
      <category>Technology and Friends</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=708c980d-da5b-4ead-b0fe-b0b79e674712</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,708c980d-da5b-4ead-b0fe-b0b79e674712.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,708c980d-da5b-4ead-b0fe-b0b79e674712.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=708c980d-da5b-4ead-b0fe-b0b79e674712</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" border="0" />
        </p>
        <p>
          <strong>Episode 58</strong>
        </p>
        <p>
In this interview, Sai Naik describes the advantages of SharePoint and where it is
a recommended solution.
</p>
        <p>
          <object id="viddler_e251ba28" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370">
            <param name="_cx" value="11562" />
            <param name="_cy" value="9789" />
            <param name="FlashVars" value="" />
            <param name="Movie" value="http://www.viddler.com/player/e251ba28/" />
            <param name="Src" value="http://www.viddler.com/player/e251ba28/" />
            <param name="WMode" value="Window" />
            <param name="Play" value="-1" />
            <param name="Loop" value="-1" />
            <param name="Quality" value="High" />
            <param name="SAlign" value="" />
            <param name="Menu" value="-1" />
            <param name="Base" value="" />
            <param name="AllowScriptAccess" value="always" />
            <param name="Scale" value="ShowAll" />
            <param name="DeviceFont" value="0" />
            <param name="EmbedMovie" value="0" />
            <param name="BGColor" value="" />
            <param name="SWRemote" value="" />
            <param name="MovieData" value="" />
            <param name="SeamlessTabbing" value="1" />
            <param name="Profile" value="0" />
            <param name="ProfileAddress" value="" />
            <param name="ProfilePort" value="0" />
            <param name="AllowNetworking" value="all" />
            <param name="AllowFullScreen" value="true" />
            <embed src="http://www.viddler.com/player/e251ba28/" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" name="viddler_e251ba28" width="437" height="370">
            </embed>
          </object>
        </p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=708c980d-da5b-4ead-b0fe-b0b79e674712" />
      </body>
      <title>Sai Naik on the benefits of SharePoint</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,708c980d-da5b-4ead-b0fe-b0b79e674712.aspx</guid>
      <link>http://www.davidgiard.com/2009/10/07/SaiNaikOnTheBenefitsOfSharePoint.aspx</link>
      <pubDate>Wed, 07 Oct 2009 13:43:04 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img src="http://www.davidgiard.com/content/binary/TechnologyAndFriends.gif" border="0"&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Episode 58&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In this interview, Sai Naik describes the advantages of SharePoint and where it is
a recommended solution.
&lt;/p&gt;
&lt;p&gt;
&lt;object id="viddler_e251ba28" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370"&gt;
&lt;param name="_cx" value="11562"&gt;
&lt;param name="_cy" value="9789"&gt;
&lt;param name="FlashVars" value=""&gt;
&lt;param name="Movie" value="http://www.viddler.com/player/e251ba28/"&gt;
&lt;param name="Src" value="http://www.viddler.com/player/e251ba28/"&gt;
&lt;param name="WMode" value="Window"&gt;
&lt;param name="Play" value="-1"&gt;
&lt;param name="Loop" value="-1"&gt;
&lt;param name="Quality" value="High"&gt;
&lt;param name="SAlign" value=""&gt;
&lt;param name="Menu" value="-1"&gt;
&lt;param name="Base" value=""&gt;
&lt;param name="AllowScriptAccess" value="always"&gt;
&lt;param name="Scale" value="ShowAll"&gt;
&lt;param name="DeviceFont" value="0"&gt;
&lt;param name="EmbedMovie" value="0"&gt;
&lt;param name="BGColor" value=""&gt;
&lt;param name="SWRemote" value=""&gt;
&lt;param name="MovieData" value=""&gt;
&lt;param name="SeamlessTabbing" value="1"&gt;
&lt;param name="Profile" value="0"&gt;
&lt;param name="ProfileAddress" value=""&gt;
&lt;param name="ProfilePort" value="0"&gt;
&lt;param name="AllowNetworking" value="all"&gt;
&lt;param name="AllowFullScreen" value="true"&gt;
&lt;embed src="http://www.viddler.com/player/e251ba28/" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" name="viddler_e251ba28" width="437" height="370"&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=708c980d-da5b-4ead-b0fe-b0b79e674712" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,708c980d-da5b-4ead-b0fe-b0b79e674712.aspx</comments>
      <category>ASP.NET</category>
      <category>Interviews</category>
      <category>SharePoint</category>
      <category>Technology and Friends</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=a34f7275-b18d-4067-9c2b-697451ce2477</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,a34f7275-b18d-4067-9c2b-697451ce2477.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,a34f7275-b18d-4067-9c2b-697451ce2477.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a34f7275-b18d-4067-9c2b-697451ce2477</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The ASP.NET MVC framework (which I will refer to as "MVC" in this article) encourages
greater separation of concerns than the older ASP.NET web forms framework.
</p>
        <p>
Some key differences between web forms and  MVC are
</p>
        <ul>
          <li>
ASPX pages in MVC have no code-behind files. This discourages developers from putting
any business logic in the view. 
</li>
          <li>
By default, URLs in MVC do not point to a file on disc. Rather, they point to an Action
in a Controller.</li>
        </ul>
        <p>
A controller is a class that inherits from <em>System.Web.Mvc.ControllerBase</em>. 
</p>
        <p>
MVC uses several conventions to find this class. First, it expects controller classes
to be in the <em>Controllers</em> folder. Also, it expects a controller class name
to end with "Controller".  So if we tell MVC to look for a <em>Product </em>controller,
it will look for the file <em>Controllers\ProductController.cs </em>or <em>Controllers\ProductController.vb</em>.
</p>
        <p>
An <em>Action </em>is a method within a Controller class that returns a <em>System.Web.Mvc.ActionResult</em>.
The <em>ActionResult </em>represents the View data that is available when MVC renders
output to the client.
</p>
        <p>
One way we can tell MVC to look for a controller is by typing a URL into the browser’s
address bar. Doing this causes MVC to use the routing engine. I described the routing
engine in a <a href="http://www.davidgiard.com/2009/10/02/RoutingURLsInASPNETMVC.aspx">previous
article</a>. The default routing assigned to a new MVC project looks for a URL with
the following format
</p>
        <p>
          <font face="Courier New">Controller/action/id</font>
        </p>
        <p>
When the routing engine encounters a URL formatted like the one above, it looks for
a controller named after the first part of the URL; an action method within that controller
named after the second part of the URL; and a parameter to pass to that method in
the third part of the URL. For example, if the user typed the following URL into the
address bar:
</p>
        <p>
          <font face="Courier New">Customer/Details/1</font>
        </p>
        <p>
, MVC would look for a class named <em>CustomerController </em>in <em>Controller\CustomerController.cs </em>(assuming
we are coding in C#). If it found this class, it would look in it for a method named
"Details" that returns an <em>ActionResult </em>and that accepts a parameter. It would
then call the <em>Details </em>method and pass it the parameter "1".
</p>
        <p>
The <em>ActionResult </em>returned by this method is used by the MVC View engine to
render output to the client. I described MVC views in a <a href="http://www.davidgiard.com/2009/10/04/ViewsInASPNETMVC.aspx">previous
article</a>.
</p>
        <p>
The code below is for a Controller Action method. It assumes the existence of the <em>GetCustomer </em>method
that returns a single customer object.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> ActionResult
Details(Int32 id) { Customer cust <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> MVCDemoRepository.GetCustomer(id); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> View(cust);
}</span>
        </pre>
        <p>
The View method called in the code above returns a <em>ViewResult </em>– a class that
inherits from <em>ActionResult</em>. By passing the Customer object to this method,
the ActionResult’s <em>Model </em>property is populated with the Customer object.
Properties of that object can then be used within the view.
</p>
        <p>
Another way to pass data from the controller to the view is to populate the <em>ViewData </em>property. <em>ViewData </em>is
a list of name-value pairs. You can populate this list in the controller and retrieve
elements from it within the view. We can modify the <em>Action </em>method above to
add to the <em>ViewData </em>list.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> ActionResult
Details(Int32 id) { ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"HelloMessage"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Good
morning to you"</span>; Customer cust <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> MVCDemoRepository.GetCustomer(id);
ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"GoodbyeMessage"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Good
night. See you later"</span>; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> View(cust);
}</span>
        </pre>
        <p>
By default, this controller routes the user to a view with the same name as the Action
in a folder named after the controller. In this case, MVC will look in the <em>\Views\Customer </em>folder
for a file named either <em>Details.aspx </em>or <em>Details.ascx</em>. If it cannot
find either of these files in that folder, it will search in the <em>Views\Shared </em>folder.
Here MVC is using configuration again to determine where to look for files.
</p>
        <p>
You can change the view MVC looks for by using an overload of the View method as in
the following example
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> View(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"CustomerDetails"</span>,
cust); </span>
        </pre>
        <p>
The above line tells MVC to look for a view page named <em>CustomerDetails.aspx </em>or <em>CustomerDetails.ascx </em>in
either <em>\Views\Customer </em>or <em>\Views\Shared</em>. 
</p>
        <p>
Here is a complete listing of a Controller class
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System.Collections.Generic; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System.Web.Mvc; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> MVCDemoController.Models; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">namespace</span> MVCDemoController.Controllers
{ <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">class</span> CustomerController
: Controller { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
GET: /Customer/</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> ActionResult
Index() { List&lt;Customer&gt; customers <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> MVCDemoRepository.GetAllCustomers(); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> View(customers);
} <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
GET: /Customer/Details/1</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> ActionResult
Details(Int32 id) { ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"HelloMessage"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Good
morning to you"</span>; Customer cust <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> MVCDemoRepository.GetCustomer(id);
ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"GoodbyeMessage"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Good
night. See you later"</span>; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> View(cust);
} } } </span>
        </pre>
        <p>
Below is a sample view to render the output from the <em>Details </em>controller action
above
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%@
Page Title=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">""</span> Language=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"C#"</span> MasterPageFile=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"~/Views/Shared/Site.Master"</span> Inherits=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"System.Web.Mvc.ViewPage&lt;MVCDemoController.Models.Customer&gt;"</span> %&gt;
&lt;asp:Content ID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Content1"</span> ContentPlaceHolderID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"TitleContent"</span> runat=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"server"</span>&gt;
    Details &lt;/asp:Content&gt; &lt;asp:Content ID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Content2"</span> ContentPlaceHolderID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"MainContent"</span> runat=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"server"</span>&gt;
&lt;h2&gt;Details&lt;/h2&gt; &lt;div&gt; &lt;%=Html.Encode(ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"HelloMessage"</span>])
%&gt; &lt;/div&gt; &lt;fieldset&gt; &lt;legend&gt;Fields&lt;/legend&gt; &lt;p&gt;
ID: &lt;%= Html.Encode(Model.ID) %&gt; &lt;/p&gt; &lt;p&gt; FirstName: &lt;%= Html.Encode(Model.FirstName)
%&gt; &lt;/p&gt; &lt;p&gt; LastName: &lt;%= Html.Encode(Model.LastName) %&gt; &lt;/p&gt;
&lt;/fieldset&gt; &lt;p&gt; &lt;%=Html.ActionLink(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Back
to List"</span>, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Index"</span>)
%&gt; &lt;/p&gt; &lt;div&gt; &lt;%=Html.Encode(ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"GoodbyeMessage"</span>])
%&gt; &lt;/div&gt; &lt;/asp:Content&gt; </span>
        </pre>
        <div id="main">
          <div style="BACKGROUND-COLOR: white">
            <h2>Details
</h2>
            <div>Good morning to you 
</div>
            <fieldset>
              <legend>Fields</legend>
              <p>
ID: 1 
</p>
              <p>
FirstName: David 
</p>
              <p>
LastName: Giard 
</p>
            </fieldset>
            <p>
              <a href="http://localhost:55216/Customer">Back to List</a>
            </p>
            <div>Good night. See you later 
</div>
          </div>
          <div id="footer">
          </div>
        </div>
        <p>
The MVC Controller is used to retrieve data from the Model, to populate any extra
data needed by the view and to determine which view to render. Understanding it is
key to understaning MVC.
</p>
        <p>
Download demo code for this article at <a href="http://www.davidgiard.com/content/binary/MVCDemoController.zip">MVCDemoController.zip
(281.08 KB)</a></p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=a34f7275-b18d-4067-9c2b-697451ce2477" />
      </body>
      <title>Controllers in ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,a34f7275-b18d-4067-9c2b-697451ce2477.aspx</guid>
      <link>http://www.davidgiard.com/2009/10/06/ControllersInASPNETMVC.aspx</link>
      <pubDate>Tue, 06 Oct 2009 04:10:09 GMT</pubDate>
      <description>&lt;p&gt;
The ASP.NET MVC framework (which I will refer to as "MVC" in this article) encourages
greater separation of concerns than the older ASP.NET web forms framework.
&lt;/p&gt;
&lt;p&gt;
Some key differences between web forms and &amp;nbsp;MVC are
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
ASPX pages in MVC have no code-behind files. This discourages developers from putting
any business logic in the view. 
&lt;li&gt;
By default, URLs in MVC do not point to a file on disc. Rather, they point to an Action
in a Controller.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
A controller is a class that inherits from &lt;em&gt;System.Web.Mvc.ControllerBase&lt;/em&gt;. 
&lt;/p&gt;
&lt;p&gt;
MVC uses several conventions to find this class. First, it expects controller classes
to be in the &lt;em&gt;Controllers&lt;/em&gt; folder. Also, it expects a controller class name
to end with "Controller".&amp;nbsp; So if we tell MVC to look for a &lt;em&gt;Product &lt;/em&gt;controller,
it will look for the file &lt;em&gt;Controllers\ProductController.cs &lt;/em&gt;or&amp;nbsp;&lt;em&gt;Controllers\ProductController.vb&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
An &lt;em&gt;Action &lt;/em&gt;is a method within a Controller class that returns a &lt;em&gt;System.Web.Mvc.ActionResult&lt;/em&gt;.
The &lt;em&gt;ActionResult &lt;/em&gt;represents the View data that is available when MVC renders
output&amp;nbsp;to the client.
&lt;/p&gt;
&lt;p&gt;
One way we can tell MVC to look for a controller is by typing a URL into the browser’s
address bar. Doing this causes MVC to use the routing engine. I described the routing
engine in a &lt;a href="http://www.davidgiard.com/2009/10/02/RoutingURLsInASPNETMVC.aspx"&gt;previous
article&lt;/a&gt;. The default routing assigned to a new MVC project looks for a URL with
the following format
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;Controller/action/id&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
When the routing engine encounters a URL formatted like the one above, it looks for
a controller named after the first part of the URL; an action method within that controller
named after the second part of the URL; and a parameter to pass to that method in
the third part of the URL. For example, if the user typed the following URL into the
address bar:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;Customer/Details/1&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
, MVC would look for a class named &lt;em&gt;CustomerController &lt;/em&gt;in &lt;em&gt;Controller\CustomerController.cs &lt;/em&gt;(assuming
we are coding in C#). If it found this class, it would look in it for a method named
"Details" that returns an &lt;em&gt;ActionResult &lt;/em&gt;and that accepts a parameter. It would
then call the &lt;em&gt;Details &lt;/em&gt;method and pass it the parameter "1".
&lt;/p&gt;
&lt;p&gt;
The &lt;em&gt;ActionResult &lt;/em&gt;returned by this method is used by the MVC View engine to
render output to the client. I described MVC views in a &lt;a href="http://www.davidgiard.com/2009/10/04/ViewsInASPNETMVC.aspx"&gt;previous
article&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The code below is for a Controller Action method. It assumes the existence of the &lt;em&gt;GetCustomer &lt;/em&gt;method
that returns a single customer object.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; ActionResult
Details(Int32 id) { Customer cust &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; MVCDemoRepository.GetCustomer(id); &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; View(cust);
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
The View method called in the code above returns a &lt;em&gt;ViewResult &lt;/em&gt;– a class that
inherits from &lt;em&gt;ActionResult&lt;/em&gt;. By passing the Customer object to this method,
the ActionResult’s &lt;em&gt;Model &lt;/em&gt;property is populated with the Customer object.
Properties of that object can then be used within the view.
&lt;/p&gt;
&lt;p&gt;
Another way to pass data from the controller to the view is to populate the &lt;em&gt;ViewData &lt;/em&gt;property. &lt;em&gt;ViewData &lt;/em&gt;is
a list of name-value pairs. You can populate this list in the controller and retrieve
elements from it within the view. We can modify the &lt;em&gt;Action &lt;/em&gt;method above to
add to the &lt;em&gt;ViewData &lt;/em&gt;list.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; ActionResult
Details(Int32 id) { ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"HelloMessage"&lt;/span&gt;] &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Good
morning to you"&lt;/span&gt;; Customer cust &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; MVCDemoRepository.GetCustomer(id);
ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"GoodbyeMessage"&lt;/span&gt;] &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Good
night. See you later"&lt;/span&gt;; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; View(cust);
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
By default, this controller routes the user to a view with the same name as the Action
in a folder named after the controller. In this case, MVC will look in the &lt;em&gt;\Views\Customer &lt;/em&gt;folder
for a file named either &lt;em&gt;Details.aspx &lt;/em&gt;or &lt;em&gt;Details.ascx&lt;/em&gt;. If it cannot
find either of these files in that folder, it will search in the &lt;em&gt;Views\Shared &lt;/em&gt;folder.
Here MVC is using configuration again to determine where to look for files.
&lt;/p&gt;
&lt;p&gt;
You can change the view MVC looks for by using an overload of the View method as in
the following example
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; View(&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"CustomerDetails"&lt;/span&gt;,
cust); &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
The above line tells MVC to look for a view page named &lt;em&gt;CustomerDetails.aspx &lt;/em&gt;or &lt;em&gt;CustomerDetails.ascx &lt;/em&gt;in
either &lt;em&gt;\Views\Customer &lt;/em&gt;or &lt;em&gt;\Views\Shared&lt;/em&gt;. 
&lt;/p&gt;
&lt;p&gt;
Here is a complete listing of a Controller class
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System.Collections.Generic; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System.Web.Mvc; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; MVCDemoController.Models; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;namespace&lt;/span&gt; MVCDemoController.Controllers
{ &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;class&lt;/span&gt; CustomerController
: Controller { &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
GET: /Customer/&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; ActionResult
Index() { List&amp;lt;Customer&amp;gt; customers &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; MVCDemoRepository.GetAllCustomers(); &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; View(customers);
} &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
GET: /Customer/Details/1&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; ActionResult
Details(Int32 id) { ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"HelloMessage"&lt;/span&gt;] &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Good
morning to you"&lt;/span&gt;; Customer cust &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; MVCDemoRepository.GetCustomer(id);
ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"GoodbyeMessage"&lt;/span&gt;] &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Good
night. See you later"&lt;/span&gt;; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; View(cust);
} } } &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Below is a sample view to render the output from the &lt;em&gt;Details &lt;/em&gt;controller action
above
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%@
Page Title=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;""&lt;/span&gt; Language=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"C#"&lt;/span&gt; MasterPageFile=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"~/Views/Shared/Site.Master"&lt;/span&gt; Inherits=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"System.Web.Mvc.ViewPage&amp;lt;MVCDemoController.Models.Customer&amp;gt;"&lt;/span&gt; %&amp;gt;
&amp;lt;asp:Content ID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Content1"&lt;/span&gt; ContentPlaceHolderID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"TitleContent"&lt;/span&gt; runat=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"server"&lt;/span&gt;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Details &amp;lt;/asp:Content&amp;gt; &amp;lt;asp:Content ID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Content2"&lt;/span&gt; ContentPlaceHolderID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"MainContent"&lt;/span&gt; runat=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"server"&lt;/span&gt;&amp;gt;
&amp;lt;h2&amp;gt;Details&amp;lt;/h2&amp;gt; &amp;lt;div&amp;gt; &amp;lt;%=Html.Encode(ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"HelloMessage"&lt;/span&gt;])
%&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;fieldset&amp;gt; &amp;lt;legend&amp;gt;Fields&amp;lt;/legend&amp;gt; &amp;lt;p&amp;gt;
ID: &amp;lt;%= Html.Encode(Model.ID) %&amp;gt; &amp;lt;/p&amp;gt; &amp;lt;p&amp;gt; FirstName: &amp;lt;%= Html.Encode(Model.FirstName)
%&amp;gt; &amp;lt;/p&amp;gt; &amp;lt;p&amp;gt; LastName: &amp;lt;%= Html.Encode(Model.LastName) %&amp;gt; &amp;lt;/p&amp;gt;
&amp;lt;/fieldset&amp;gt; &amp;lt;p&amp;gt; &amp;lt;%=Html.ActionLink(&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Back
to List"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Index"&lt;/span&gt;)
%&amp;gt; &amp;lt;/p&amp;gt; &amp;lt;div&amp;gt; &amp;lt;%=Html.Encode(ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"GoodbyeMessage"&lt;/span&gt;])
%&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;/asp:Content&amp;gt; &lt;/span&gt;&lt;/pre&gt;
&lt;div id=main&gt;
&lt;div style="BACKGROUND-COLOR: white"&gt;
&lt;h2&gt;Details
&lt;/h2&gt;
&lt;div&gt;Good morning to you 
&lt;/div&gt;
&lt;fieldset&gt;
&lt;legend&gt;Fields&lt;/legend&gt;
&lt;p&gt;
ID: 1 
&lt;/p&gt;
&lt;p&gt;
FirstName: David 
&lt;/p&gt;
&lt;p&gt;
LastName: Giard 
&lt;/p&gt;
&lt;/fieldset&gt;
&lt;p&gt;
&lt;a href="http://localhost:55216/Customer"&gt;Back to List&lt;/a&gt; 
&lt;/p&gt;
&lt;div&gt;Good night. See you later 
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=footer&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The MVC Controller is used to retrieve data from the Model, to populate any extra
data needed by the view and to determine which view to render. Understanding it is
key to understaning MVC.
&lt;/p&gt;
&lt;p&gt;
Download demo code for this article at &lt;a href="http://www.davidgiard.com/content/binary/MVCDemoController.zip"&gt;MVCDemoController.zip
(281.08 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=a34f7275-b18d-4067-9c2b-697451ce2477" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,a34f7275-b18d-4067-9c2b-697451ce2477.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=6eccac1d-8dcc-4850-8209-1de020b6d62b</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,6eccac1d-8dcc-4850-8209-1de020b6d62b.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,6eccac1d-8dcc-4850-8209-1de020b6d62b.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6eccac1d-8dcc-4850-8209-1de020b6d62b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
The ASP.NET MVC framework (which I will refer to as "MVC" in this article) encourages
developers to work closer to actual rendered HTML than does the more traditional web
forms ASP.NET framework. The web form framework abstracted away much of the HTML,
allowing developers to create sophisticated web pages simply by dragging controls
onto a design surface. In fact, with the web forms framework, it is sometimes possible
for someone with no knowledge of HTML to build an entire web application.
</p>
        <p>
But MVC’s view engine removes that abstraction, encouraging users to write more of
their own HTML. By doing so, developers also get more control over what is rendered
to the client.
</p>
        <p>
Some web developers may be surprised to learn that most of the server controls they
are used to dragging onto a design surface do not work in MVC. This is because ASP.NET
server controls are self-contained objects that encapsulate all their functionality,
including the C# or VB code they run. This is contrary to the way that MVC works.
In the MVC framework, all business logic code is in either the model (if it applies
to the data) or in the controller if it applies to routing or output.
</p>
        <p>
An MVC view consists only of an ASPX page. By default it doesn't even contain a code-behind
file.
</p>
        <p>
Let’s analyze a typical MVC view. Like a web form, an MVC view contains a page directive
at the top.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%@
Page Title=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Sports"</span> Language=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"C#"</span> MasterPageFile=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"~/Views/Shared/Site.Master"</span> Inherits=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"System.Web.Mvc.ViewPage&lt;TestMvc.Models.Customer"</span>&gt;
%&gt;</span>
        </pre>
        <p>
The <em>Title</em>, <em>Language </em>and <em>MasterPageFile </em>attributes should
be familiar to anyone who has developed in ASP.NET. The meanings of these attributes
have not changed in MVC. The <em>Inherits </em>attribute is also used in web forms
development, but in this case, we are inheriting from a <em>ViewPage </em>that contains
our model.  The model represents the data we wish to render (I will write more
about the MVC model in a future article.) By inheriting from a <em>ViewPage</em>,
we provide the model data directly to the page and we can strongly type the keyword
Model to whatever data type our model is.
</p>
        <p>
Mixed in with the HTML of our page, we can output some server side data by enclosing
it in &lt;% %&gt; tags.
</p>
        <p>
If you wrote any web sites with classic ASP (the predecessor to ASP.NET), you probably
used these tags. (I recently heard someone refer to them as "bee stingers"). 
If you place "=" in front of a value or variable, the view engine will output the
value or contents of that variable. For example
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%=System.DateTime.Now
%&gt;</span>
        </pre>
        <p>
outputs the current date and time, like the following
</p>
        <p>
          <font face="Courier New">10/2/2009 6:08:46 PM</font>
        </p>
        <p>
We mentioned earlier that the <em>Model </em>keyword is strongly-typed. For example,
If we inherit our ASPX from  <em>System.Web.Mvc.ViewPage&lt;TestMvc.Models.Customer&gt;</em>,
then our model represents a <em>Customer </em>object and we can output a property
of that model class.
</p>
        <p>
Assuming that our Model is uses the following Customer class:
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span>
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">class</span> Customer
{ <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> FirstName
{ get; set; } <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> LastName
{ get; set; } }</span>
        </pre>
        <p>
, we can output the <em>FirstName </em>property with the following markup:
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%=
Model.FirstName %&gt; </span>
        </pre>
        <p>
You probably already know that it is almost always a bad idea to output text directly
for the screen without encoding it, as I did above. Failure to do so may leave your
site open to scripting attacks. Fortunately MVC includes an <em>Encode </em>helper
method to encode strings for safer output. That helper method (along with other helpers)
is available via the <em>Html </em>property of the <em>ViewPage </em>from which our
view inherits. We can call the helper method and encode the first name with the following
markup.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%=
Html.Encode(Model.FirstName) %&gt;</span>
        </pre>
        <p>
This outputs the <em>FirstName </em>property, but encodes it to prevent problems if
the first name property somehow gets infected with some client-side script.
</p>
        <p>
Other helper methods of the ViewPage give you the ability to begin and end an HTML
form, to render an HTML textbox, to render a hidden field, to render an HTML listbox,
and perform many other useful functions.
</p>
        <p>
The code below will output a hyperlink with the text "Home" that links to the Index
method in the Home controller.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%=
Html.ActionLink(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home"</span>, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Index"</span>, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home"</span>)%&gt;</span>
        </pre>
        <p>
Another way to use data in the view is to store it in ViewData. ViewData is a property
of the view and contains a dictionary of name/value pairs. You can add a value to
this dictionary in the controller with code like the following
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Greetings"</span>] <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Hello
dummy"</span>;</span>
        </pre>
        <p>
and display a ViewData element in the view with markup like the following
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%=
Html.Encode(ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Greetings"</span>])
%&gt;</span>
        </pre>
        <p>
Below is the full markup for a sample MVC view page
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">&lt;%@
Page Title=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">""</span> Language=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"C#"</span> MasterPageFile=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"~/Views/Shared/Site.Master"</span> Inherits=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"System.Web.Mvc.ViewPage&lt;MVCDemoView.Models.Customer&gt;"</span> %&gt;
&lt;asp:Content ID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Content1"</span> ContentPlaceHolderID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"TitleContent"</span> runat=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"server"</span>&gt;
Index &lt;/asp:Content&gt; &lt;asp:Content ID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Content2"</span> ContentPlaceHolderID=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"MainContent"</span> runat=<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"server"</span>&gt;
&lt;div&gt; &lt;%= Html.Encode(ViewData[<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Greetings"</span>])
%&gt; &lt;/div&gt; &lt;div&gt; &lt;%= Html.Encode(Model.FirstName) %&gt; &lt;%= Html.Encode(Model.LastName)
%&gt; &lt;/div&gt; &lt;div&gt; &lt;%= Html.ActionLink(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home"</span>, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Index"</span>, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home"</span>)%&gt;
&lt;/div&gt; &lt;/asp:Content&gt; </span>
        </pre>
        <p>
Here is the output of the view page above
</p>
        <div id="main">
          <div style="BACKGROUND-COLOR: white">
            <div>Hello dummy 
</div>
            <div>David Giard 
</div>
            <div>
              <a href="http://localhost:61683/">Home</a>
            </div>
          </div>
          <div id="footer">
          </div>
        </div>
        <p>
If you don’t like the view engine that ships with MVC, it is possible to replace it
with your own. Some open source projects, such as <a href="http://sparkviewengine.com/" target="_blank">Spark</a> have
already given users this ability.
</p>
        <p>
Using the MVC view engine encourages developers to have more control over the output
sent to the client and provides a greater separation of concerns for the application
as a whole.
</p>
        <p>
Download the code for this sample at <a href="http://www.davidgiard.com/content/binary/MVCDemoView.zip">MVCDemoView.zip
(281.64 KB)</a></p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=6eccac1d-8dcc-4850-8209-1de020b6d62b" />
      </body>
      <title>Views in ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,6eccac1d-8dcc-4850-8209-1de020b6d62b.aspx</guid>
      <link>http://www.davidgiard.com/2009/10/04/ViewsInASPNETMVC.aspx</link>
      <pubDate>Sun, 04 Oct 2009 19:38:29 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The ASP.NET MVC framework (which I will refer to as "MVC" in this article) encourages
developers to work closer to actual rendered HTML than does the more traditional web
forms ASP.NET framework. The web form framework abstracted away much of the HTML,
allowing developers to create sophisticated web pages simply by dragging controls
onto a design surface. In fact, with the web forms framework, it is sometimes possible
for someone with no knowledge of HTML to build an entire web application.
&lt;/p&gt;
&lt;p&gt;
But MVC’s view engine removes that abstraction, encouraging users to write more of
their own HTML. By doing so, developers also get more control over what is rendered
to the client.
&lt;/p&gt;
&lt;p&gt;
Some web developers may be surprised to learn that most of the server controls they
are used to dragging onto a design surface do not work in MVC. This is because ASP.NET
server controls are self-contained objects that encapsulate all their functionality,
including the C# or VB code they run. This is contrary to the way that MVC works.
In the MVC framework, all business logic code is in either the model (if it applies
to the data) or in the controller if it applies to routing or output.
&lt;/p&gt;
&lt;p&gt;
An MVC view consists only of an ASPX page. By default it doesn't even contain a code-behind
file.
&lt;/p&gt;
&lt;p&gt;
Let’s analyze a typical MVC view. Like a web form, an MVC view contains a page directive
at the top.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%@
Page Title=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Sports"&lt;/span&gt; Language=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"C#"&lt;/span&gt; MasterPageFile=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"~/Views/Shared/Site.Master"&lt;/span&gt; Inherits=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"System.Web.Mvc.ViewPage&amp;lt;TestMvc.Models.Customer"&lt;/span&gt;&amp;gt;
%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
The &lt;em&gt;Title&lt;/em&gt;, &lt;em&gt;Language &lt;/em&gt;and &lt;em&gt;MasterPageFile &lt;/em&gt;attributes should
be familiar to anyone who has developed in ASP.NET. The meanings of these attributes
have not changed in MVC. The &lt;em&gt;Inherits &lt;/em&gt;attribute is also used in web forms
development, but in this case, we are inheriting from a &lt;em&gt;ViewPage &lt;/em&gt;that contains
our model.&amp;nbsp; The model represents the data we wish to render (I will write more
about the MVC model in a future article.) By inheriting from a &lt;em&gt;ViewPage&lt;/em&gt;,
we provide the model data directly to the page and we can strongly type the keyword
Model to whatever data type our model is.
&lt;/p&gt;
&lt;p&gt;
Mixed in with the HTML of our page, we can output some server side data by enclosing
it in &amp;lt;% %&amp;gt; tags.
&lt;/p&gt;
&lt;p&gt;
If you wrote any web sites with classic ASP (the predecessor to ASP.NET), you probably
used these tags. (I recently heard someone refer to them as "bee stingers").&amp;nbsp;
If you place "=" in front of a value or variable, the view engine will output the
value or contents of that variable. For example
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%=System.DateTime.Now
%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
outputs the current date and time, like the following
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;10/2/2009 6:08:46 PM&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
We mentioned earlier that the &lt;em&gt;Model &lt;/em&gt;keyword is strongly-typed. For example,
If we inherit our ASPX from&amp;nbsp; &lt;em&gt;System.Web.Mvc.ViewPage&amp;lt;TestMvc.Models.Customer&amp;gt;&lt;/em&gt;,
then our model represents a &lt;em&gt;Customer &lt;/em&gt;object and we can output a property
of that model class.
&lt;/p&gt;
&lt;p&gt;
Assuming that our Model is uses the following Customer class:
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;class&lt;/span&gt; Customer
{ &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; FirstName
{ get; set; } &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; LastName
{ get; set; } }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
, we can output the &lt;em&gt;FirstName &lt;/em&gt;property with the following markup:
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%=
Model.FirstName %&amp;gt; &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
You probably already know that it is almost always a bad idea to output text directly
for the screen without encoding it, as I did above. Failure to do so may leave your
site open to scripting attacks. Fortunately MVC includes an &lt;em&gt;Encode &lt;/em&gt;helper
method to encode strings for safer output. That helper method (along with other helpers)
is available via the &lt;em&gt;Html &lt;/em&gt;property of the &lt;em&gt;ViewPage &lt;/em&gt;from which our
view inherits. We can call the helper method and encode the first name with the following
markup.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%=
Html.Encode(Model.FirstName) %&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
This outputs the &lt;em&gt;FirstName &lt;/em&gt;property, but encodes it to prevent problems if
the first name property somehow gets infected with some client-side script.
&lt;/p&gt;
&lt;p&gt;
Other helper methods of the ViewPage give you the ability to begin and end an HTML
form, to render an HTML textbox, to render a hidden field, to render an HTML listbox,
and perform many other useful functions.
&lt;/p&gt;
&lt;p&gt;
The code below will output a hyperlink with the text "Home" that links to the Index
method in the Home controller.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%=
Html.ActionLink(&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Home"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Index"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Home"&lt;/span&gt;)%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Another way to use data in the view is to store it in ViewData. ViewData is a property
of the view and contains a dictionary of name/value pairs. You can add a value to
this dictionary in the controller with code like the following
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Greetings"&lt;/span&gt;] &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Hello
dummy"&lt;/span&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
and display a ViewData element in the view with markup like the following
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%=
Html.Encode(ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Greetings"&lt;/span&gt;])
%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Below is the full markup for a&amp;nbsp;sample&amp;nbsp;MVC view page
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&amp;lt;%@
Page Title=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;""&lt;/span&gt; Language=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"C#"&lt;/span&gt; MasterPageFile=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"~/Views/Shared/Site.Master"&lt;/span&gt; Inherits=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"System.Web.Mvc.ViewPage&amp;lt;MVCDemoView.Models.Customer&amp;gt;"&lt;/span&gt; %&amp;gt;
&amp;lt;asp:Content ID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Content1"&lt;/span&gt; ContentPlaceHolderID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"TitleContent"&lt;/span&gt; runat=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"server"&lt;/span&gt;&amp;gt;
Index &amp;lt;/asp:Content&amp;gt; &amp;lt;asp:Content ID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Content2"&lt;/span&gt; ContentPlaceHolderID=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"MainContent"&lt;/span&gt; runat=&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"server"&lt;/span&gt;&amp;gt;
&amp;lt;div&amp;gt; &amp;lt;%= Html.Encode(ViewData[&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Greetings"&lt;/span&gt;])
%&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;div&amp;gt; &amp;lt;%= Html.Encode(Model.FirstName) %&amp;gt; &amp;lt;%= Html.Encode(Model.LastName)
%&amp;gt; &amp;lt;/div&amp;gt; &amp;lt;div&amp;gt; &amp;lt;%= Html.ActionLink(&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Home"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Index"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Home"&lt;/span&gt;)%&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;/asp:Content&amp;gt; &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
Here is the output of the view page above
&lt;/p&gt;
&lt;div id=main&gt;
&lt;div style="BACKGROUND-COLOR: white"&gt;
&lt;div&gt;Hello dummy 
&lt;/div&gt;
&lt;div&gt;David Giard 
&lt;/div&gt;
&lt;div&gt;&lt;a href="http://localhost:61683/"&gt;Home&lt;/a&gt; 
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=footer&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If you don’t like the view engine that ships with MVC, it is possible to replace it
with your own. Some open source projects, such as &lt;a href="http://sparkviewengine.com/" target=_blank&gt;Spark&lt;/a&gt; have
already given users this ability.
&lt;/p&gt;
&lt;p&gt;
Using the MVC view engine encourages developers to have more control over the output
sent to the client and provides a greater separation of concerns for the application
as a whole.
&lt;/p&gt;
&lt;p&gt;
Download the code for this sample at &lt;a href="http://www.davidgiard.com/content/binary/MVCDemoView.zip"&gt;MVCDemoView.zip
(281.64 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=6eccac1d-8dcc-4850-8209-1de020b6d62b" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,6eccac1d-8dcc-4850-8209-1de020b6d62b.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=3e31b5ae-5e6c-442a-a773-ffbbe4232aff</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,3e31b5ae-5e6c-442a-a773-ffbbe4232aff.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,3e31b5ae-5e6c-442a-a773-ffbbe4232aff.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3e31b5ae-5e6c-442a-a773-ffbbe4232aff</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the differences between ASP.NET MVC  and traditional ASP.NET web forms
is the URL typed by the user.
</p>
        <p>
In traditional ASP.NET, a URL points to a physical page on disc. Typically one can
infer the location of that page by examining the URL. For example, the URL 
</p>
        <p>
          <font face="Courier New">/Folder1/MyPage.aspx </font>
        </p>
        <p>
likely points to a file named MyPage.aspx located in a folder named Folder1.
</p>
        <p>
By contrast, a URL in an ASP.NET MVC application points to an action in a controller.
For example, the URL
</p>
        <p>
          <font face="Courier New">/Customer/Edit/2</font>
        </p>
        <p>
Tells the MVC framework to pass a parameter of "2" to an action method named Edit
in a Customer controller class.
</p>
        <p>
ASP.NET MVC (which I’ll call MVC going forward) uses routing to map a URL to a specific
action. Routing is typically configured in the  Application_OnStart method of
the global.asax file.  An MVC application contains a System.Web.Routing.RouteTable,
which contains a collection of routes on which it can act. When you create a new MVC
project, a default route is added to this collection by adding the following code
in global.asax.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">routes.MapRoute( <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"> "Default"</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Route name</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"> "{controller}/{action}/{id}"</span>, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
URL with parameters</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"> new</span> {
controller <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Home"</span>,
action <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"Index"</span>,
id <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">""</span> } <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Parameter defaults</span> ); </span>
        </pre>
        <p>
This code adds a route named "Default" to the route table. This route tells MVC to
look for a URL structured similar to the following
</p>
        <p>
          <font face="Courier New">Controller/action/id</font>
        </p>
        <p>
When it encounters such a URL, it looks for a controller class with a name based on
the first part of the URL. By convention, MVC looks for controllers in the "Controllers"
folder and is named with the suffix "Controller". So if the first part of the URL
is "Customer", MVC will look in the controllers folder for a class derived from System.Web.Mvc.Controller
named "CustomerController". 
</p>
        <p>
The second part of the URL identifies an action. The action is a method within the
controller that returns a  System.Web.Mvc.ActionResult. The ActionResult identifies
the view used to render a response (more on that in a later article). So if the second
part of the URL is "Edit", MVC will look for a method in the controller class named
"Edit" that returns an ActionResult. 
</p>
        <p>
The third part of the above URL defines a parameter for the action, in this case a
parameter named "id". 
</p>
        <p>
The following URL
</p>
        <p>
          <font face="Courier New">/Customer/Edit/2</font>
        </p>
        <p>
causes MVC to search for a class named <em>Controllers\CustomerController</em>, to
call the <em>Edit</em> method in this class and to pass the value <em>2</em> to the <em>id</em> parameter
of the Edit method.
</p>
        <p>
What if the URL does not contain all three parts? The Default route above specifies
a default value for each of the parts. If the third part of the URL is omitted, no
parameter is passed to the Action. For a URL with no id parameter, we will need to
create an action method that does not expect a parameter. If the second part of the
URL is omitted, the default action is "Index", so MVC will look for a method named
"Index" in the controller class. If the first part of the URL is omitted, it defaults
to "Home" so MVC will look for a Controller class named "HomeController" in the Controllers
folder.
</p>
        <p>
You can use this same syntax to add more routes to your application. Simply add more
calls to routes.MapRoute() in Global.asax. MVC will match URLs to these routes in
the order listed.
</p>
        <p>
Notice that the RouteTable and RouteCollection are part of the System.Web.Routing
namespace and not part of any MVC namespace. This should tell you that the routing
engine is not restricted to MVC applications. It can be used in any ASP.NET application
if you want cleaner URLs.
</p>
        <p>
If you find a URL like <font face="Courier New">/Customer/Edit/2 </font>more
asthetically pleasing than <font face="Courier New">/Customers/EditCustomer.aspx?CustID=2</font>,
you should investigate the routing engine.
</p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=3e31b5ae-5e6c-442a-a773-ffbbe4232aff" />
      </body>
      <title>Routing URLs in ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,3e31b5ae-5e6c-442a-a773-ffbbe4232aff.aspx</guid>
      <link>http://www.davidgiard.com/2009/10/02/RoutingURLsInASPNETMVC.aspx</link>
      <pubDate>Fri, 02 Oct 2009 13:21:00 GMT</pubDate>
      <description>&lt;p&gt;
One of the differences between ASP.NET MVC&amp;nbsp; and traditional ASP.NET web forms
is the URL typed by the user.
&lt;/p&gt;
&lt;p&gt;
In traditional ASP.NET, a URL points to a physical page on disc. Typically one can
infer the location of that page by examining the URL. For example, the URL 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;/Folder1/MyPage.aspx &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
likely points to a file named MyPage.aspx located in a folder named Folder1.
&lt;/p&gt;
&lt;p&gt;
By contrast, a URL in an ASP.NET MVC application points to an action in a controller.
For example, the URL
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;/Customer/Edit/2&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Tells the MVC framework to pass a parameter of "2" to an action method named Edit
in a Customer controller class.
&lt;/p&gt;
&lt;p&gt;
ASP.NET MVC (which I’ll call MVC going forward) uses routing to map a URL to a specific
action. Routing is typically configured in the&amp;nbsp; Application_OnStart method of
the global.asax file.&amp;nbsp; An MVC application contains a System.Web.Routing.RouteTable,
which contains a collection of routes on which it can act. When you create a new MVC
project, a default route is added to this collection by adding the following code
in global.asax.
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;routes.MapRoute( &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt; "Default"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
Route name&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt; "{controller}/{action}/{id}"&lt;/span&gt;, &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
URL with parameters&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt; new&lt;/span&gt; {
controller &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Home"&lt;/span&gt;,
action &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"Index"&lt;/span&gt;,
id &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;""&lt;/span&gt; } &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
Parameter defaults&lt;/span&gt; ); &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
This code adds a route named "Default" to the route table. This route tells MVC to
look for a URL structured similar to the following
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;Controller/action/id&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
When it encounters such a URL, it looks for a controller class with a name based on
the first part of the URL. By convention, MVC looks for controllers in the "Controllers"
folder and is named with the suffix "Controller". So if the first part of the URL
is "Customer", MVC will look in the controllers folder for a class derived from System.Web.Mvc.Controller
named "CustomerController". 
&lt;/p&gt;
&lt;p&gt;
The second part of the URL identifies an action. The action is a method within the
controller that returns a&amp;nbsp; System.Web.Mvc.ActionResult. The ActionResult identifies
the view used to render a response (more on that in a later article). So if the second
part of the URL is "Edit", MVC will look for a method in the controller class named
"Edit" that returns an ActionResult. 
&lt;/p&gt;
&lt;p&gt;
The third part of the above URL defines a parameter for the action, in this case a
parameter named "id". 
&lt;/p&gt;
&lt;p&gt;
The following URL
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;/Customer/Edit/2&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
causes MVC to search for a class named &lt;em&gt;Controllers\CustomerController&lt;/em&gt;, to
call the &lt;em&gt;Edit&lt;/em&gt; method in this class and to pass the value &lt;em&gt;2&lt;/em&gt; to the &lt;em&gt;id&lt;/em&gt; parameter
of the Edit method.
&lt;/p&gt;
&lt;p&gt;
What if the URL does not contain all three parts? The Default route above specifies
a default value for each of the parts. If the third part of the URL is omitted, no
parameter is passed to the Action. For a URL with no id parameter, we will need to
create an action method that does not expect a parameter. If the second part of the
URL is omitted, the default action is "Index", so MVC will look for a method named
"Index" in the controller class. If the first part of the URL is omitted, it defaults
to "Home" so MVC will look for a Controller class named "HomeController" in the Controllers
folder.
&lt;/p&gt;
&lt;p&gt;
You can use this same syntax to add more routes to your application. Simply add more
calls to routes.MapRoute() in Global.asax. MVC will match URLs to these routes in
the order listed.
&lt;/p&gt;
&lt;p&gt;
Notice that the RouteTable and RouteCollection are part of the System.Web.Routing
namespace and not part of any MVC namespace. This should tell you that the routing
engine is not restricted to MVC applications. It can be used in any ASP.NET application
if you want cleaner URLs.
&lt;/p&gt;
&lt;p&gt;
If you&amp;nbsp;find a URL like &lt;font face="Courier New"&gt;/Customer/Edit/2 &lt;/font&gt;more
asthetically pleasing than&amp;nbsp;&lt;font face="Courier New"&gt;/Customers/EditCustomer.aspx?CustID=2&lt;/font&gt;,
you should investigate the routing engine.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=3e31b5ae-5e6c-442a-a773-ffbbe4232aff" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,3e31b5ae-5e6c-442a-a773-ffbbe4232aff.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=cf64d7ef-9116-426d-8c61-06659e83b666</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,cf64d7ef-9116-426d-8c61-06659e83b666.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,cf64d7ef-9116-426d-8c61-06659e83b666.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cf64d7ef-9116-426d-8c61-06659e83b666</wfw:commentRss>
      <slash:comments>8</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
Microsoft first released ASP.NET almost eight years ago. At that time, they created
a model they hoped would be familiar (and compelling) to Windows forms developers,
particularly to those working in Visual Basic 6. 
</p>
        <p>
ASP.NET adopted a development paradigm that mimicked Windows forms. This programming
model was referred to as “web forms” and it abstracted away much of the complexity
of HTML and HTTP, easing the transition from Windows to the web for many developers.
Using web forms, developers could drag controls, such as buttons and textboxes, onto
a design surface and add code that ran automatically when a user interacted with a
control – such as when a user clicks a button. Pages and controls had events, such
as Load and Init that ran at specified times during a page’s creation. By default,
each page had a code-behind file – class containing code that responded to page events.
These concepts were familiar to Visual Basic developers and this helped to drive adoption
of ASP.NET.
</p>
        <p>
But there are some drawbacks to this model. Web forms abstracted away the details
of HTML and HTTP, but this abstraction cost the developer control over the rendering
of pages and controls. Some developers felt that the web forms framework got in the
way of their web developing by hiding these basic constructs. Also, tying code to
web form events made it difficult to test much of the application. Testing frameworks
evolved that would mimic the behavior of a web server, just to integrate with automated
unit testing frameworks.
</p>
        <p>
Recently Microsoft released ASP.NET MVC - a new programming framework designed to
build web applications with HTML and HTTP. This framework uses the Model-View-Controller
pattern.
</p>
        <p>
The Model-View-Controller pattern is not new. However the release of ASP.NET MVC (I’ll
refer to it as "MVC" going forward) has renewed interest in this pattern.
</p>
        <p>
MVC consists of three main parts. You’ll never guess what they are. Give up? They
are the Model, the View and the Controller.
</p>
        <p>
The <em>Model </em>contains the application’s data and any business rules associated
with that data. It is up to the Model to retrieve and update data from and to a database
(or other persistent data store or back-end), to validate that data and to apply any
business rules to that data.
</p>
        <p>
The <em>View </em>is a template for the user interface. It should contain no logic
at all. In fact, in the ASP.NET MVC framework, by default View web pages don’t even
have a code-behind file. A view in this framework consists only of HTML mixed with
some placeholders to output values from the model or helper functions based on those
values.
</p>
        <p>
The <em>Controller </em>is the glue that binds the Model to the View. By default,
each web request in ASP.NET MVC gets routed to a given method (known as an “Action”)
of a given class (known as a "Controller"). This method executes and returns either
a view or enough information for the framework to identify and render a view.
</p>
        <p>
MVC has two main advantages over web forms –It is easier to test and it gives more
control to the developer.
</p>
        <p>
Separating an application into three distinct parts makes it far easier to test. 
Launching a user interface in an automated testing framework, such as NUnit or MSTest
is possible but it’s clumsy and slow. Minimizing the code in the user interface allows
us to test the code more easily.
</p>
        <p>
MVC also gives the developer more control over the rendered HTML (the view) than is
possible in web forms. Web forms deliberately abstract away much of the HTML rendering,
while MVC forces the developer to write explicit HTML in his View templates. 
</p>
        <p>
The release of ASP.NET MVC certainly does not signal the end of web forms. 
Many developers appreciate the abstraction that web forms provides for them. Many
web forms still exist in production and I have yet to hear anyone refer to these as
"legacy" applications or "Classic ASP.NET". 
</p>
        <p>
But for those who want more control over their output, a more pure separation of concerns
and easier testability, ASP.NET MVC offers a good option.<br /></p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=cf64d7ef-9116-426d-8c61-06659e83b666" />
      </body>
      <title>Why ASP.NET MVC?</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,cf64d7ef-9116-426d-8c61-06659e83b666.aspx</guid>
      <link>http://www.davidgiard.com/2009/10/01/WhyASPNETMVC.aspx</link>
      <pubDate>Thu, 01 Oct 2009 12:39:21 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Microsoft first released ASP.NET almost eight years ago. At that time, they created
a model they hoped would be familiar (and compelling) to Windows forms developers,
particularly to those working in Visual Basic 6. 
&lt;/p&gt;
&lt;p&gt;
ASP.NET adopted a development paradigm that mimicked Windows forms. This programming
model was referred to as “web forms” and it abstracted away much of the complexity
of HTML and HTTP, easing the transition from Windows to the web for many developers.
Using web forms, developers could drag controls, such as buttons and textboxes, onto
a design surface and add code that ran automatically when a user interacted with a
control – such as when a user clicks a button. Pages and controls had events, such
as Load and Init that ran at specified times during a page’s creation. By default,
each page had a code-behind file – class containing code that responded to page events.
These concepts were familiar to Visual Basic developers and this helped to drive adoption
of ASP.NET.
&lt;/p&gt;
&lt;p&gt;
But there are some drawbacks to this model. Web forms abstracted away the details
of HTML and HTTP, but this abstraction cost the developer control over the rendering
of pages and controls. Some developers felt that the web forms framework got in the
way of their web developing by hiding these basic constructs. Also, tying code to
web form events made it difficult to test much of the application. Testing frameworks
evolved that would mimic the behavior of a web server, just to integrate with automated
unit testing frameworks.
&lt;/p&gt;
&lt;p&gt;
Recently Microsoft released ASP.NET MVC - a new programming framework designed to
build web applications with HTML and HTTP. This framework uses the Model-View-Controller
pattern.
&lt;/p&gt;
&lt;p&gt;
The Model-View-Controller pattern is not new. However the release of ASP.NET MVC (I’ll
refer to it as "MVC" going forward) has renewed interest in this pattern.
&lt;/p&gt;
&lt;p&gt;
MVC consists of three main parts. You’ll never guess what they are. Give up? They
are the Model, the View and the Controller.
&lt;/p&gt;
&lt;p&gt;
The &lt;em&gt;Model &lt;/em&gt;contains the application’s data and any business rules associated
with that data. It is up to the Model to retrieve and update data from and to a database
(or other persistent data store or back-end), to validate that data and to apply any
business rules to that data.
&lt;/p&gt;
&lt;p&gt;
The &lt;em&gt;View &lt;/em&gt;is a template for the user interface. It should contain no logic
at all. In fact, in the ASP.NET MVC framework, by default View web pages don’t even
have a code-behind file. A view in this framework consists only of HTML mixed with
some placeholders to output values from the model or helper functions based on those
values.
&lt;/p&gt;
&lt;p&gt;
The &lt;em&gt;Controller &lt;/em&gt;is the glue that binds the Model to the View. By default,
each web request in ASP.NET MVC gets routed to a given method (known as an “Action”)
of a given class (known as a "Controller"). This method executes and returns either
a view or enough information for the framework to identify and render a view.
&lt;/p&gt;
&lt;p&gt;
MVC has two main advantages over web forms –It is easier to test and it gives more
control to the developer.
&lt;/p&gt;
&lt;p&gt;
Separating an application into three distinct parts makes it far easier to test.&amp;nbsp;
Launching a user interface in an automated testing framework, such as NUnit or MSTest
is possible but it’s clumsy and slow. Minimizing the code in the user interface allows
us to test the code more easily.
&lt;/p&gt;
&lt;p&gt;
MVC also gives the developer more control over the rendered HTML (the view) than is
possible in web forms. Web forms deliberately abstract away much of the HTML rendering,
while MVC forces the developer to write explicit HTML in his View templates. 
&lt;/p&gt;
&lt;p&gt;
The release of ASP.NET MVC certainly does not&amp;nbsp;signal the end of web forms.&amp;nbsp;
Many developers appreciate the abstraction that web forms provides for them. Many
web forms still exist in production and I have yet to hear anyone refer to these as
"legacy" applications or "Classic ASP.NET". 
&lt;/p&gt;
&lt;p&gt;
But for those who want more control over their output, a more pure separation of concerns
and easier testability, ASP.NET MVC offers a good option.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=cf64d7ef-9116-426d-8c61-06659e83b666" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,cf64d7ef-9116-426d-8c61-06659e83b666.aspx</comments>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=4f448b31-a480-468d-8f51-a99ae54341bf</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,4f448b31-a480-468d-8f51-a99ae54341bf.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,4f448b31-a480-468d-8f51-a99ae54341bf.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4f448b31-a480-468d-8f51-a99ae54341bf</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I started using DasBlog for this blog almost two years ago. 
</p>
        <p>
For the past couple months, I've been struggling trying to add a permanent page to
my web site. By permanent, I mean a page that is always relevant and is always available
at the top of the site; as opposed to a blog post, which is dated and moves down as
new blog posts are added. 
</p>
        <p>
My biggest problem is that I wanted the new page to have the same theme as all existing
pages. It seemed simple enough but DasBlog did not provide an obvious way to do this.
</p>
        <p>
Recently I discovered an old post by Omar Shahine at <a href="http://www.shahine.com/omar/FormatPageMacroInDasBlog.aspx">http://www.shahine.com/omar/FormatPageMacroInDasBlog.aspx</a></p>
        <p>
He described in detail exactly what I wanted to do. 
</p>
        <p>
Essentially, I create a file named xxx.format.html and add any static HTML I want
on my new page. To apply the theme, I need to use FormatPage.aspx, which ships with
DasBlog. FormatPage.aspx accepts a parameter path, which points to an HTML document
and displays that document with the current theme applied.
</p>
        <p>
After uploading my HTML page, I can apply a theme by linking to <font face="Arial">FormatPage.aspx?path=DaveSchedule.format.html.</font></p>
        <p>
Now I have a link in a tab at the top of every page pointing to my past and upcoming
speaking schedule and that page has the same theme as the rest of the site.<br /></p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=4f448b31-a480-468d-8f51-a99ae54341bf" />
      </body>
      <title>Formatting an HTML page in DasBlog</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,4f448b31-a480-468d-8f51-a99ae54341bf.aspx</guid>
      <link>http://www.davidgiard.com/2009/08/22/FormattingAnHTMLPageInDasBlog.aspx</link>
      <pubDate>Sat, 22 Aug 2009 15:43:00 GMT</pubDate>
      <description>&lt;p&gt;
I started using DasBlog for this blog almost two years ago. 
&lt;/p&gt;
&lt;p&gt;
For the past couple months, I've been struggling trying to add a permanent page to
my web site. By permanent, I mean a page that is always relevant and is always available
at the top of the site; as opposed to a blog post, which is dated and moves down as
new blog posts are added. 
&lt;/p&gt;
&lt;p&gt;
My biggest problem is that I wanted the new page to have the same theme as all existing
pages. It seemed simple enough but DasBlog did not provide an obvious way to do this.
&lt;/p&gt;
&lt;p&gt;
Recently I discovered an old post by Omar Shahine at &lt;a href="http://www.shahine.com/omar/FormatPageMacroInDasBlog.aspx"&gt;http://www.shahine.com/omar/FormatPageMacroInDasBlog.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
He described in detail exactly what I wanted to do. 
&lt;/p&gt;
&lt;p&gt;
Essentially, I create a file named xxx.format.html and add any static HTML I want
on my new page. To apply the theme, I need to use FormatPage.aspx, which ships with
DasBlog. FormatPage.aspx accepts a parameter path, which points to an HTML document
and displays that document with the current theme applied.
&lt;/p&gt;
&lt;p&gt;
After uploading my HTML page, I can apply a theme by linking to &lt;font face=Arial&gt;FormatPage.aspx?path=DaveSchedule.format.html.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Now I have a link in a tab at the top of every page pointing to my past and upcoming
speaking schedule and that page has the same theme as the rest of the site.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=4f448b31-a480-468d-8f51-a99ae54341bf" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,4f448b31-a480-468d-8f51-a99ae54341bf.aspx</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=539f21ef-e671-43a3-b1f5-80cb05f76179</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,539f21ef-e671-43a3-b1f5-80cb05f76179.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,539f21ef-e671-43a3-b1f5-80cb05f76179.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=539f21ef-e671-43a3-b1f5-80cb05f76179</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>MVC Tutorial 3: Using an ID to specify an individual model object</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,539f21ef-e671-43a3-b1f5-80cb05f76179.aspx</guid>
      <link>http://www.davidgiard.com/2008/08/27/MVCTutorial3UsingAnIDToSpecifyAnIndividualModelObject.aspx</link>
      <pubDate>Wed, 27 Aug 2008 12:26:29 GMT</pubDate>
      <description>&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Microsoft recently released the ASP.Net Model
View Controller framework (MVC).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;It is
currently available as Preview 3 and can be downloaded at &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en"&gt;&lt;font color=#0000ff size=3 face=Calibri&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;A new MVC project contains a couple
sample views and controllers so you can get an idea of the proper syntax to use.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;This article builds on the application created
in my last ASP.Net MVC tutorial.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If you
have not already done so, please follow the brief states in the &lt;/font&gt;&lt;a href="http://www.davidgiard.com/default.aspx?page=admin#acec3a0f8-d59f-411d-b306-1de56db15e3a"&gt;&lt;font color=#0000ff size=3 face=Calibri&gt;previous
MVC tutorial&lt;/font&gt;&lt;/a&gt;&lt;font color=#000000 size=3 face=Calibri&gt; before beginning this
tutorial&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;In the last tutorial, we added a model, view
and controller to display a list of customers that one can navigate to using a URL
formatted as &lt;i style="mso-bidi-font-style: normal"&gt;controller/action&lt;/i&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In
this article, we will add a new view and controller to an existing MVC project and
display details of a single customer using a URL formatted as &lt;i style="mso-bidi-font-style: normal"&gt;controller/action/id&lt;/i&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;id&lt;/i&gt; is
passed automatically to the action method and allows us to filter to a single customer.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;1.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Open
Visual Studio 2008 and open the &lt;i style="mso-bidi-font-style: normal"&gt;TestMVC&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; solution
created in &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;a href="http://www.davidgiard.com/2008/08/22/MVCTutorial2AddingCustomModelsViewsAndControllers.aspx"&gt;&lt;font size=3 face=Calibri&gt;MVC
Tutorial 2&lt;/font&gt;&lt;/a&gt;&lt;font color=#000000 size=3 face=Calibri&gt;.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;2.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Open
the Solution Explorer (&lt;b style="mso-bidi-font-weight: normal"&gt;View | Solution Explorer&lt;/b&gt;)
and select the &lt;i style="mso-bidi-font-style: normal"&gt;Controllers\CustomerController.cs&lt;/i&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Double-click &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; to
open it in the code editor.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; class,
we will create a new action to get the details of a single customer. &lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font size=3&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Add
the following private &lt;i style="mso-bidi-font-style: normal"&gt;GetCustomer&lt;/i&gt; method
to the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt; class.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In
the last tutorial, we wrote methods to retrieve customer 1 and customer 2.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;For
simplicity, we will get Customer 1 if ID 1 is passed in to our method and Customer
2 if any other ID is passed.&lt;br&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;
&lt;v:shapetype id=_x0000_t202 path="m,l,21600r21600,l21600,xe" o:spt="202" coordsize="21600,21600"&gt;
&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
&lt;v:path o:connecttype="rect" gradientshapeok="t"&gt;&lt;/v:path&gt;
&lt;/v:shapetype&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 123.45pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1029 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;private&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; GetCustomer(&lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;font color=#000000&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt; custID)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (custID
== 1)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; GetCustomer1();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;else&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; GetCustomer2();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;&lt;?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;v:shapetype id=_x0000_t75 path="m@4@5l@4@11@9@11@9@5xe" o:spt="75" coordsize="21600,21600" stroked="f" filled="f" o:preferrelative="t"&gt;
&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
&lt;v:formulas&gt;
&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;
&lt;/v:formulas&gt;
&lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;
&lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;
&lt;/v:shapetype&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Add
an Action method to the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt; class
to get the details of a customer.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Paste
the following code into &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController.cs&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=#000000 size=3 face=Calibri&gt;.&lt;br&gt;
&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 60.45pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1028 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;ActionResult&lt;/span&gt;&lt;font color=#000000&gt; Details(&lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;font color=#000000&gt; id)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; cust
= GetCustomer(id);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; View(&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Details"&lt;/span&gt;&lt;font color=#000000&gt;,
cust);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;i style="mso-bidi-font-style: normal"&gt;GetCustomer&lt;/i&gt; method, we get details
of a single customer and return a view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Unlike
the generated code, we explicitly specify which view to return (“Details”) and we
pass in some extra data (&lt;i style="mso-bidi-font-style: normal"&gt;cust&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;)
that the view will consume.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;3.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Add
a view to the project.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;i style="mso-bidi-font-style: normal"&gt;Views\Customer&lt;/i&gt; folder
and select &lt;b style="mso-bidi-font-weight: normal"&gt;Add | New Item&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Add
New Item&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; dialog
displays.&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080827_Fig1.jpg" target=_pix&gt;&lt;img style="WIDTH: 365px; HEIGHT: 163px" border=0 src="http://www.davidgiard.com/content/binary/MVC20080827_Fig1.jpg" width=525 height=290&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
1&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Categories&lt;/i&gt;,
select &lt;b style="mso-bidi-font-weight: normal"&gt;Visual C#\Web\MVC&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Templates&lt;/i&gt;,
select&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;MVC
View Content Page&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Name&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt; textbox,
enter “Details”.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iv.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Select
a Master Page&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt; dialog displays.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;
&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080822_Fig3.jpg" target=_pix&gt;&lt;img style="WIDTH: 334px; HEIGHT: 201px" src="http://www.davidgiard.com/content/binary/MVC20080822_Fig3.jpg" width=362 height=230&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
2&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 2in; mso-list: l0 level4 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;1.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Navigate
to the &lt;i style="mso-bidi-font-style: normal"&gt;Views\Shared&lt;/i&gt; folder and select &lt;b style="mso-bidi-font-weight: normal"&gt;Site.Master&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 2in; mso-list: l0 level4 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;2.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Click
the OK button to add this view content page to the project.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Add
visual elements to the View&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;If
it is not already open, open the &lt;i style="mso-bidi-font-style: normal"&gt;Details&lt;/i&gt; view
by double-clicking &lt;i style="mso-bidi-font-style: normal"&gt;List.aspx&lt;/i&gt; in the Solution
Explorer.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Click the &lt;i style="mso-bidi-font-style: normal"&gt;Source &lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;tab
at the bottom of the editor.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font color=#000000&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000 size=3 face=Calibri&gt;Replace
the code in Details.aspx with the following&lt;br&gt;
&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 280.95pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1027 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;@&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;Page&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Title&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=""&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Language&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="C#"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;MasterPageFile&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="~/Views/Shared/Site.Master"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="true"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Details.aspx.cs"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Inherits&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="TestMVC.Views.Customers.Details"&lt;/span&gt;&lt;font color=#000000&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;@&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;Import&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Namespace&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="TestMVC.Views.Customers"&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;@&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;Import&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Namespace&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="TestMVC.Models"&lt;/span&gt;&lt;font color=#000000&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;asp&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;:&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;Content&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;ID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Content1"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="MainContent"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;div&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CustID:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).CustID &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Name:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).FirstName &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt; 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).LastName &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt; 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Address:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).StreetAddress&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;City:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).City &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;State:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).State &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ZIP:&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;((&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;)ViewData.Model).PostalCode&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;div&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;asp&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;:&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;Content&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;br&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;The above code displays details
of a single &lt;i style="mso-bidi-font-style: normal"&gt;Customer&lt;/i&gt; model object.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;4.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Modify
the List view&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Open &lt;i style="mso-bidi-font-style: normal"&gt;Views\Customers\List.aspx&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; by
double-clicking it in Solution Explorer.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Find
the &amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;\td&amp;gt; cell tag following the cust.PostalCode cell.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Replace
this with the following code.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This generates
a hyperlink displaying the text “Details”.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=#000000 size=3 face=Calibri&gt;The
URL of the hyperlink will have the current controller (“Customer”) the “Details” Action
and the ID of the current customer.&lt;br&gt;
&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 39.45pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1026 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;td&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;Html.ActionLink(&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Details"&lt;/span&gt;&lt;font color=#000000&gt;, &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Details"&lt;/span&gt;&lt;font color=#000000&gt;, &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt; {
ID=cust.CustID})&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;td&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;5.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Test
the application&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Save
and compile the solution (&lt;b style="mso-bidi-font-weight: normal"&gt;Build | Build Solution&lt;/b&gt;).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;Correct
any errors you find.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Run
the solution (&lt;b style="mso-bidi-font-weight: normal"&gt;Debug | Start Debugging&lt;/b&gt;).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;Depending
on the port number used by Casini, it should display in your browser with a URL such
as&lt;br&gt;
&lt;/font&gt;&lt;span style="FONT-FAMILY: 'Courier New'"&gt;http://localhost:4152/Home&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font color=#000000&gt;&lt;font size=3 face=Calibri&gt;c.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000 size=3 face=Calibri&gt;Navigate
to the List page by changing the URL to&lt;br&gt;
&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: 'Courier New'"&gt;http://localhost:4152/Customers/List&lt;br&gt;
&lt;/span&gt;&lt;font face=Calibri&gt;(Replace the port number if necessary)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;d.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;You
should see a list of 2 customers in your browser.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;Each
customer should have a hyperlink labeled “Details”.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080827_Fig4.jpg" target=_pix&gt;&lt;img style="WIDTH: 330px; HEIGHT: 278px" border=0 src="http://www.davidgiard.com/content/binary/MVC20080827_Fig4.jpg" width=384 height=310&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
3&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;e.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Click
the hyperlink next to customer 1.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=#000000 size=3 face=Calibri&gt;The
URL should change to&lt;br&gt;
&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: 'Courier New'"&gt;http://localhost:4152/Customers/Details/1&lt;br&gt;
&lt;/span&gt;&lt;font face=Calibri&gt;and the details of the first customer should display on
screen.&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080827_Fig5.jpg" target=_pix&gt;&lt;img border=0 src="http://www.davidgiard.com/content/binary/MVC20080827_Fig5.jpg" width=328 height=284&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
4&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;f.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Set
a breakpoint in the &lt;i style="mso-bidi-font-style: normal"&gt;Details&lt;/i&gt; method of &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController.cs&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; and
refresh the page to step through the code as it executes.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;In this article, we added a view
and controller to our application and used these to retrieve and display customer
details by the Customer ID.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=539f21ef-e671-43a3-b1f5-80cb05f76179" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,539f21ef-e671-43a3-b1f5-80cb05f76179.aspx</comments>
      <category>.Net</category>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=cec3a0f8-d59f-411d-b306-1de56db15e3a</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,cec3a0f8-d59f-411d-b306-1de56db15e3a.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,cec3a0f8-d59f-411d-b306-1de56db15e3a.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cec3a0f8-d59f-411d-b306-1de56db15e3a</wfw:commentRss>
      <title>MVC Tutorial 2: Adding custom models, views and controllers</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,cec3a0f8-d59f-411d-b306-1de56db15e3a.aspx</guid>
      <link>http://www.davidgiard.com/2008/08/22/MVCTutorial2AddingCustomModelsViewsAndControllers.aspx</link>
      <pubDate>Fri, 22 Aug 2008 13:02:34 GMT</pubDate>
      <description>&lt;p class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Microsoft recently released the ASP.Net Model
View Controller framework (MVC).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;It is
currently available as Preview 3 and can be downloaded at &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en" target=_blank&gt;&lt;font color=#0000ff size=3 face=Calibri&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;A new MVC project contains a couple
sample views and controllers so you can get an idea of the proper syntax to use.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;In this article, we will add a
new model, view and controller to an existing MVC project.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;1.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Open
Visual Studio 2008 and create a new MVC project.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;For
information on how to create a new MVC project, see &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;a href="http://www.davidgiard.com/2008/08/18/TheASPNetMVCSampleAppDemystified.aspx"&gt;&lt;font color=#0000ff size=3 face=Calibri&gt;http://www.davidgiard.com/2008/08/18/TheASPNetMVCSampleAppDemystified.aspx&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;2.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Open
the Solution Explorer (&lt;b style="mso-bidi-font-weight: normal"&gt;View | Solution Explorer&lt;/b&gt;)
and select the &lt;i style="mso-bidi-font-style: normal"&gt;Models&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; folder.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;3.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Add
a Model to the project&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Right-click
the Models folder and select &lt;b style="mso-bidi-font-weight: normal"&gt;Add | Class&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Add
New Item&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; dialog
displays.&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080822_Fig1.jpg" target=_pix&gt;&lt;img style="WIDTH: 466px; HEIGHT: 369px" border=0 alt="Figure 1" src="http://www.davidgiard.com/content/binary/MVC20080822_Fig1.jpg" width=539 height=411&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
1&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;At
the Name textbox, enter “Customer”.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Click
the OK button to create a &lt;i style="mso-bidi-font-style: normal"&gt;Customer&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; class.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Customer&lt;/i&gt; class
opens in the class editor.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This class
will contain a few public properties that help describe a customer object.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Add
the following code to the &lt;i style="mso-bidi-font-style: normal"&gt;Customer&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; class.&lt;br&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;
&lt;v:shapetype id=_x0000_t202 path="m,l,21600r21600,l21600,xe" o:spt="202" coordsize="21600,21600"&gt;
&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
&lt;v:path o:connecttype="rect" gradientshapeok="t"&gt;&lt;/v:path&gt;
&lt;/v:shapetype&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;v:shape style="WIDTH: 341.75pt; HEIGHT: 112.95pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1030 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;class&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;Customer&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;font color=#000000&gt; CustID
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&lt;font color=#000000&gt; FirstName
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&lt;font color=#000000&gt; LastName
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&lt;font color=#000000&gt; StreetAddress
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&lt;font color=#000000&gt; City
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&lt;font color=#000000&gt; State
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&lt;font color=#000000&gt; PostalCode
{ &lt;/font&gt;&lt;span style="COLOR: blue"&gt;get&lt;/span&gt;&lt;font color=#000000&gt;; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;set&lt;/span&gt;&lt;font color=#000000&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;&lt;?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;v:shapetype id=_x0000_t75 path="m@4@5l@4@11@9@11@9@5xe" o:spt="75" coordsize="21600,21600" stroked="f" filled="f" o:preferrelative="t"&gt;
&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
&lt;v:formulas&gt;
&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;
&lt;/v:formulas&gt;
&lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;
&lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;
&lt;/v:shapetype&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;4.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Add
a Controller to the project&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;i style="mso-bidi-font-style: normal"&gt;Controllers&lt;/i&gt; folder
and select &lt;b style="mso-bidi-font-weight: normal"&gt;Add | New Item&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Add
New Item&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; dialog
displays.&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080822_Fig2.jpg" target=_pix&gt;&lt;img border=0 alt="Figure 2" src="http://www.davidgiard.com/content/binary/MVC20080822_Fig2.jpg" width=470 height=318&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;
&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure 2&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Categories&lt;/i&gt;,
select &lt;b style="mso-bidi-font-weight: normal"&gt;Visual C#\Web\MVC&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Templates&lt;/i&gt;,
select MVC&lt;b style="mso-bidi-font-weight: normal"&gt; Controller Class&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Name&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt; textbox,
enter “CustomerController”.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iv.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Click
the &lt;b style="mso-bidi-font-weight: normal"&gt;Add&lt;/b&gt; button to create the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; class
and open it in the class editor.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt; class, we will create
some actions.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Each action will instantiate
one or more &lt;i style="mso-bidi-font-style: normal"&gt;Model&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; objects
and display them in a view object.&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font size=3&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Add
the following statement at the top of the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; class.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 18.45pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1029 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; TestMVC.Models;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Add
the following private methods to the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt; class.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;For
now, we will create customers out of thin air (as if it were that easy).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=#000000 size=3 face=Calibri&gt;In
a real application, we would probably call a web server or query a database to get
customers.&lt;br&gt;
&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 448.95pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1028 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;#region&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; private
methods&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;private&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; GetCustomer1()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; cust1
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CustID
= 1,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FirstName
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"David"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LastName
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Giard"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;StreetAddress
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"123 Main"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;City
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Boringville"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;State
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"MI"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PostalCode
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"48108"&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; cust1;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;private&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; GetCustomer2()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; cust2
= &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CustID
= 2,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FirstName
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"John"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LastName
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Smith"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;StreetAddress
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"321 Elm"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;City
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Nowhere"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;State
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"OH"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PostalCode
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"41001"&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; cust2;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;private&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;&amp;gt;
GetAllCustomers()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; cust1
= GetCustomer1();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; cust2
= GetCustomer2();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;&amp;gt;
allCusts = &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;&amp;gt;
{cust1, cust2};&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; allCusts;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;#endregion&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Add
some Action method to the &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController&lt;/i&gt; class.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;We’ll
start with a List action.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Paste the following
code into &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController.cs&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=#000000 size=3 face=Calibri&gt;.&lt;br&gt;
&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 60.45pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1027 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;ActionResult&lt;/span&gt;&lt;font color=#000000&gt; List()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt;&lt;font color=#000000&gt; allCustomers
= GetAllCustomers();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; View(&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"List"&lt;/span&gt;&lt;font color=#000000&gt;,
allCustomers);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iv.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;i style="mso-bidi-font-style: normal"&gt;List&lt;/i&gt;, we get a list of customers (all
2 of them) and return a view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Unlike
the generated code, we explicitly specify which view to return (“List”) and we pass
in some extra data (&lt;i style="mso-bidi-font-style: normal"&gt;allCustomers&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;)
that the view will consume.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;5.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Add
a view to the project.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;i style="mso-bidi-font-style: normal"&gt;Views&lt;/i&gt; folder
and select &lt;b style="mso-bidi-font-weight: normal"&gt;Add | New Folder&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;A
new folder appears in the Solution Explorer.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;Rename
this folder to “Customer”.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;i style="mso-bidi-font-style: normal"&gt;Customer&lt;/i&gt; folder
and select &lt;b style="mso-bidi-font-weight: normal"&gt;Add | New Item&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Add
New Item&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; dialog
displays.&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Categories&lt;/i&gt;,
select &lt;b style="mso-bidi-font-weight: normal"&gt;Visual C#\Web\MVC&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Templates&lt;/i&gt;,
select&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;MVC
View Content Page&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;In
the &lt;b style="mso-bidi-font-weight: normal"&gt;Name&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt; textbox,
enter “List”.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;iv.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Select
a Master Page&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt; dialog displays.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080822_Fig3.jpg" target=_pix&gt;&lt;img border=0 alt="Figure 3" src="http://www.davidgiard.com/content/binary/MVC20080822_Fig3.jpg" width=486 height=294&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
4&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 2in; mso-list: l0 level4 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;1.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Navigate
to the &lt;i style="mso-bidi-font-style: normal"&gt;Views\Shared&lt;/i&gt; folder and select &lt;b style="mso-bidi-font-weight: normal"&gt;Site.Master&lt;/b&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 2in; mso-list: l0 level4 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;2.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Click
the OK button to add this view content page to the project.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;c.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Add
visual elements to the View&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;i.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;If
it is not already open, open the &lt;i style="mso-bidi-font-style: normal"&gt;List&lt;/i&gt; view
by double-clicking &lt;i style="mso-bidi-font-style: normal"&gt;List.aspx&lt;/i&gt; in the Solution
Explorer.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Click the &lt;i style="mso-bidi-font-style: normal"&gt;Source &lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;tab
at the bottom of the editor.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -1.5in; MARGIN: 0in 0in 0pt 1.5in; mso-list: l0 level3 lfo1; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;
&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font color=#000000&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font size=3 face=Calibri&gt;ii.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000 size=3 face=Calibri&gt;Replace
the code in List.aspx with the following&lt;br&gt;
&lt;/font&gt;
&lt;v:shape style="WIDTH: 395.05pt; HEIGHT: 406.95pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1026 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;@&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;Page&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Title&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=""&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Language&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="C#"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;MasterPageFile&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="~/Views/Shared/Site.Master"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="true"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="List.aspx.cs"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Inherits&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="TestMVC.Views.Customers.List"&lt;/span&gt;&lt;font color=#000000&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;@&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;Import&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Namespace&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="TestMVC.Views.Customers"&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;@&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;Import&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;Namespace&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="TestMVC.Models"&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;asp&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;:&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;Content&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;ID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Content1"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="MainContent"&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;h2&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt; Html.Encode(ViewData[&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Message"&lt;/span&gt;&lt;font color=#000000&gt;]) &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;h2&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;table&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;ID&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;First&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;Last&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;Addr&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;City&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;State&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt;ZIP&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt;&lt;font color=#000000&gt; (&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt; cust &lt;/font&gt;&lt;span style="COLOR: blue"&gt;in&lt;/span&gt;&lt;font color=#000000&gt; (&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Customer&lt;/span&gt;&lt;font color=#000000&gt;&amp;gt;)ViewData.Model)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.CustID &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.FirstName&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.LastName&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.StreetAddress&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.City&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.State&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&lt;font color=#000000&gt;&amp;lt;%&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;&lt;font color=#000000&gt;cust.PostalCode&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt; 
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;


&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt; } &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;table&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;asp&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;:&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;Content&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&gt;
&gt;
&gt;
&gt;&gt;
&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&gt;
&lt;br&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;The above code displays a list of &lt;i style="mso-bidi-font-style: normal"&gt;Customer&lt;/i&gt; model
objects.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In a real-world example, we
may choose to have the Customer model derive from a base class and only refer to the
base class in the view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This would increase
the separation between our view and our model.&lt;/font&gt;&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;6.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Test
the application&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Save
and compile the solution (&lt;b style="mso-bidi-font-weight: normal"&gt;Build | Build Solution&lt;/b&gt;).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;Correct
any errors you find.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Run
the solution (&lt;b style="mso-bidi-font-weight: normal"&gt;Debug | Start Debugging&lt;/b&gt;).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;Depending
on the port number used by Casini, it should display in your browser with a URL such
as&lt;br&gt;
&lt;/font&gt;&lt;span style="FONT-FAMILY: 'Courier New'"&gt;http://localhost:4152/Home&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font color=#000000&gt;&lt;font size=3 face=Calibri&gt;c.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color=#000000 size=3 face=Calibri&gt;Navigate
to the List page by changing the URL to&lt;br&gt;
&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: 'Courier New'"&gt;http://localhost:4152/Customers/List&lt;br&gt;
&lt;/span&gt;&lt;font face=Calibri&gt;(Replace the port number if necessary)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font color=#000000&gt;&lt;font size=3 face=Calibri&gt;d.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;You
should see a list of 2 customers in your browser&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080822_Fig4.jpg" target=_pix&gt;&lt;img style="WIDTH: 523px; HEIGHT: 389px" border=0 alt="Figure 4" src="http://www.davidgiard.com/content/binary/MVC20080822_Fig4.jpg" width=523 height=460&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
4&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 1in; mso-list: l0 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;e.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Set
a breakpoint in the &lt;i style="mso-bidi-font-style: normal"&gt;List&lt;/i&gt; method of &lt;i style="mso-bidi-font-style: normal"&gt;CustomerController.cs&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; and
refresh the page to step through the code as it executes.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;In this article, we created a model, view
and controller from scratch and displayed them.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;font color=#000000 size=3 face=Calibri&gt;You
can download the code for this project &lt;a href="http://www.davidgiard.com/content/binary/TestMVC.zip"&gt;here&lt;/a&gt;.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&gt;In the next article, we will use the ID of the URL to specify a single customer.&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=cec3a0f8-d59f-411d-b306-1de56db15e3a" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,cec3a0f8-d59f-411d-b306-1de56db15e3a.aspx</comments>
      <category>.Net</category>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=955be66f-d47d-418f-9f1d-9c740e395960</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,955be66f-d47d-418f-9f1d-9c740e395960.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,955be66f-d47d-418f-9f1d-9c740e395960.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=955be66f-d47d-418f-9f1d-9c740e395960</wfw:commentRss>
      <title>MVC Tutorial 1: The ASP.Net MVC Sample app demystified</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,955be66f-d47d-418f-9f1d-9c740e395960.aspx</guid>
      <link>http://www.davidgiard.com/2008/08/18/MVCTutorial1TheASPNetMVCSampleAppDemystified.aspx</link>
      <pubDate>Mon, 18 Aug 2008 15:37:58 GMT</pubDate>
      <description>&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Microsoft recently released the ASP.Net Model
View Controller framework (ASP.Net MVC).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;It
is currently available as Community Technology Preview 3 and can be downloaded at &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en"&gt;&lt;font size=3 face=Calibri&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en&lt;/font&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;This article describes how to create an ASP.Net
MVC application and the code that is auto-generated for you.&lt;/font&gt;
&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color=#4f81bd size=4 face=Cambria&gt;Creating
a new ASP.Net MVC project&lt;/font&gt;
&lt;/h2&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;1.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;Open
Visual Studio 2008.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Create a new project:
Select &lt;b style="mso-bidi-font-weight: normal"&gt;File | New Project&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;New
Project&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; dialog
displays.&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080818_Fig1.jpg" target=_pix&gt;&lt;img style="WIDTH: 355px; HEIGHT: 230px" border=0 src="http://www.davidgiard.com/content/binary/MVC20080818_Fig1.jpg" width=458 height=315&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
1&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Project
Type&lt;/i&gt;, select &lt;i style="mso-bidi-font-style: normal"&gt;Visual Basic\Web&lt;/i&gt; or &lt;i style="mso-bidi-font-style: normal"&gt;Visual
C#\Web&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;, depending on your language preference. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;Under &lt;i style="mso-bidi-font-style: normal"&gt;Templates&lt;/i&gt;,
select &lt;i style="mso-bidi-font-style: normal"&gt;ASP.Net MVC Web Application&lt;/i&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;This
application was added when you installed the ASP.Net MVC preview.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;c.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Provide
an appropriate location and name for the project and solution.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;d.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Click
the OK button to create the project.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;2.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3&gt;&lt;font face=Calibri&gt;One
of the advantages of an ASP.Net MVC project is that the separation of most of the
code from the user interface makes it easier to write unit tests.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Visual
Studio encourages you to create unit tests for your new project by prompting you with
the &lt;b style="mso-bidi-font-weight: normal"&gt;Create Unit Test Project&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt; dialog
every time you create an MVC project.&lt;br&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080818_Fig2.jpg" target=_pix&gt;&lt;img border=0 src="http://www.davidgiard.com/content/binary/MVC20080818_Fig2.jpg" width=325 height=216&gt; &lt;/a&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Figure
2&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;If
you wish, you can decline to create a Unit Test project or you can change the default
project name.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;Typically
I do not change any defaults on this dialog.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 1in; mso-list: l1 level2 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;Click
the OK button to create the Unit Test project.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color=#4f81bd size=4 face=Cambria&gt;The Folder
structure of an MVC project&lt;/font&gt;
&lt;/h2&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;When you create a new MVC project, Visual
Studio, generates a couple views and controllers.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If
you understand how these work, you can use them to guide how you will create more
views and controllers. &lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;The solution contains two projects: an MVC
project and a unit test project.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;View the projects in Solution Explorer.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Select &lt;b style="mso-bidi-font-weight: normal"&gt;View
| Solution Explorer&lt;/b&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The MVC project
contains several folders.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;a href="http://www.davidgiard.com/content/binary/MVC20080818_Fig3.jpg" target=_pix&gt;&lt;img border=0 src="http://www.davidgiard.com/content/binary/MVC20080818_Fig3.jpg"&gt; &lt;/a&gt;
&lt;br&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;Figure
3&lt;o:p&gt;&lt;/o:p&gt;
&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpFirst&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;1.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Content&lt;/i&gt; folder
contains a stylesheet &lt;i style="mso-bidi-font-style: normal"&gt;Site.css&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; for
this site.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;2.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Controllers&lt;/i&gt; folder
is where you will store all your controller classes.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;By
default, this folder contains a single controller class - &lt;i style="mso-bidi-font-style: normal"&gt;HomeController.cs&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;3.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Models&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; folder
is where you will store any model classes for your application.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;4.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Views&lt;/i&gt; folder
contains a subfolder for each view in your application.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;By
default, there are two subfolders: &lt;i style="mso-bidi-font-style: normal"&gt;Home&lt;/i&gt; and &lt;i style="mso-bidi-font-style: normal"&gt;Shared&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font size=3&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;a.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Shared &lt;/i&gt;subfolder
contains a master page for the site because it is shared by multiple web pages.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;Any
other UI elements shared by the site belong in this folder.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;b.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;Home&lt;/i&gt; folder
contains two pages: &lt;i style="mso-bidi-font-style: normal"&gt;About.aspx&lt;/i&gt; and &lt;i style="mso-bidi-font-style: normal"&gt;Index.aspx&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt;.&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font size=3&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpLast&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3 face=Calibri&gt;5.&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;As
with most web applications, the root folder of this project contains a &lt;i style="mso-bidi-font-style: normal"&gt;Global.asax&lt;/i&gt; file
and a &lt;i style="mso-bidi-font-style: normal"&gt;Web.Config&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; file,
which contain setup and configuration information for the application as a whole.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color=#4f81bd size=4 face=Cambria&gt;The Files
and Folders of an MVC project&lt;/font&gt;
&lt;/h2&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;Open Global.asax and view the
code.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Notice that the Application_Start
method (which fires once, at the startup of the web application) contains a call to
the &lt;i style="mso-bidi-font-style: normal"&gt;RegisterRoutes&lt;/i&gt; method. The &lt;i style="mso-bidi-font-style: normal"&gt;RegisterRoutes&lt;/i&gt; method
tells the MVC framework how to interpret a URL.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;
&lt;v:shapetype id=_x0000_t202 path="m,l,21600r21600,l21600,xe" o:spt="202" coordsize="21600,21600"&gt;
&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
&lt;v:path o:connecttype="rect" gradientshapeok="t"&gt;&lt;/v:path&gt;
&lt;/v:shapetype&gt;
&lt;v:shape style="WIDTH: 433.3pt; HEIGHT: 144.45pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1027 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;static&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt;&lt;font color=#000000&gt; RegisterRoutes(&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;RouteCollection&lt;/span&gt;&lt;font color=#000000&gt; routes)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;routes.IgnoreRoute(&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"{resource}.axd/{*pathInfo}"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;routes.MapRoute(&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;"Default"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: green"&gt;//
Route name&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;"{controller}/{action}/{id}"&lt;/span&gt;&lt;font color=#000000&gt;,&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: green"&gt;//
URL with parameters&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt; {
controller = &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Home"&lt;/span&gt;&lt;font color=#000000&gt;,
action = &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Index"&lt;/span&gt;&lt;font color=#000000&gt;, id
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;""&lt;/span&gt;&lt;font color=#000000&gt; }&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;span style="COLOR: green"&gt;//
Parameter defaults&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;&lt;?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;v:shapetype id=_x0000_t75 path="m@4@5l@4@11@9@11@9@5xe" o:spt="75" coordsize="21600,21600" stroked="f" filled="f" o:preferrelative="t"&gt;
&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
&lt;v:formulas&gt;
&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;
&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;
&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;
&lt;/v:formulas&gt;
&lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;
&lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;
&lt;/v:shapetype&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;routes.MapRoute&lt;/i&gt; method
accomplishes this.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In this case, a “Default”
route collection is created that interprets a URL with syntax like “&lt;/font&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;{controller}/{action}/{id}&lt;/span&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;”.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpFirst&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The
first part of the URL specifies the controller to use.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;MVC
looks in the Controllers folder for a class that inherits from &lt;i style="mso-bidi-font-style: normal"&gt;System.Web.Mvc.Controller&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; with
a name that matches the controller specified in the URL.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The
second part of the URL specifies the action to take.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;The
action is the public method within this controller that will be called.&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font size=3&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.75in; mso-list: l2 level1 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;The
third part of the URL specifies an id to pass to the action method.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This
can be used to further customize the action.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font size=3&gt;For
example, we could use the id as a filter to dynamically look up a single row in a
database.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;The &lt;i style="mso-bidi-font-style: normal"&gt;routes.MapRoute&lt;/i&gt; method
also allows us to specify defaults if no &lt;i style="mso-bidi-font-style: normal"&gt;controller&lt;/i&gt; or &lt;i style="mso-bidi-font-style: normal"&gt;action&lt;/i&gt; or &lt;i style="mso-bidi-font-style: normal"&gt;id&lt;/i&gt; is
specified in the URL.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If any of these
are omitted from the URL, MVC will use the defaults specified in the third parameter
of &lt;i style="mso-bidi-font-style: normal"&gt;routes.Maproute&lt;/i&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In
this case the object &lt;/font&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;new&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; {
controller = &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Home"&lt;/span&gt;&lt;font color=#000000&gt;,
action = &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Index"&lt;/span&gt;&lt;font color=#000000&gt;, id
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;""&lt;/span&gt;&lt;font color=#000000&gt; } &lt;/font&gt;&lt;/span&gt;&lt;font color=#000000 size=3 face=Calibri&gt;tells
MVC the following:&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l3 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpFirst&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;If
no &lt;i style="mso-bidi-font-style: normal"&gt;Controller&lt;/i&gt; is specified in the URL,
assume the &lt;i style="mso-bidi-font-style: normal"&gt;Home&lt;/i&gt; controller (i.e., look
for a class named “Home.cs” in the &lt;i style="mso-bidi-font-style: normal"&gt;Controllers&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; folder).&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l3 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri&gt;&lt;font size=3&gt;If
no &lt;i style="mso-bidi-font-style: normal"&gt;Action&lt;/i&gt; is specified in the URL, assume
the &lt;i style="mso-bidi-font-style: normal"&gt;Index&lt;/i&gt; action (i.e., look for a public
method “Index” in the &lt;i style="mso-bidi-font-style: normal"&gt;Home.cs&lt;/i&gt;&lt;/font&gt;&lt;font size=3&gt; class).&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.75in; mso-list: l3 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;
&lt;font color=#000000&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size=3&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size=3 face=Calibri&gt;If
no ID is specified in the URL, assume a blank ID (i.e., any code looking for an ID
will retrieve an empty string).&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Open the view files: &lt;i style="mso-bidi-font-style: normal"&gt;Home.aspx&lt;/i&gt; and &lt;i style="mso-bidi-font-style: normal"&gt;About.aspx&lt;/i&gt; and
notice that there is no code behind in either.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This
is because ASP.Net MVC applications do not execute the page life cycle.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;All
the code for this application is in the controllers.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;These
view pages contain only visual elements.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Open the controller class: Homecontroller.cs.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;As
we mentioned before, this class derives from the System.Web.Mvc.Controller class and
it contains two methods: &lt;i style="mso-bidi-font-style: normal"&gt;Index&lt;/i&gt; and &lt;i style="mso-bidi-font-style: normal"&gt;About&lt;/i&gt;.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;v:shape style="WIDTH: 400.7pt; HEIGHT: 280.95pt; mso-height-percent: 200; mso-left-percent: -10001; mso-top-percent: -10001; mso-position-horizontal: absolute; mso-position-horizontal-relative: char; mso-position-vertical: absolute; mso-position-vertical-relative: line; mso-width-relative: margin; mso-height-relative: margin" id=_x0000_s1026 type="#_x0000_t202"&gt;
&lt;v:textbox style="mso-fit-shape-to-text: t"&gt;
&lt;table cellspacing=0 cellpadding=0 width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0"&gt;
&lt;div&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Linq;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Web;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Web.Mvc;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;namespace&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; TestMVC.Controllers&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: blue"&gt;class&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;HomeController&lt;/span&gt;&lt;font color=#000000&gt; : &lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Controller&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;ActionResult&lt;/span&gt;&lt;font color=#000000&gt; Index()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ViewData[&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Title"&lt;/span&gt;&lt;font color=#000000&gt;]
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Home Page"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ViewData[&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Message"&lt;/span&gt;&lt;font color=#000000&gt;]
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Welcome to ASP.NET MVC!"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; View();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt;&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;ActionResult&lt;/span&gt;&lt;font color=#000000&gt; About()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ViewData[&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Title"&lt;/span&gt;&lt;font color=#000000&gt;]
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"About Page"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; View();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/v:textbox&gt;
&lt;w:wrap type="none"&gt;&lt;/w:wrap&gt;
&lt;w:anchorlock&gt;&lt;/w:anchorlock&gt;
&lt;/v:shape&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;“HomeController” is the name of the class
to implement the &lt;i style="mso-bidi-font-style: normal"&gt;Home&lt;/i&gt; controller.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This
is typical of how MVC works – developers follow naming conventions in order tell the
framework where to find the code to run.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In
the case of controllers, we implement a controller by sub-classing the &lt;i style="mso-bidi-font-style: normal"&gt;System.Web.Mvc.Controller&lt;/i&gt; class,
naming this subclass “xxxController” (where xxx is the &lt;i style="mso-bidi-font-style: normal"&gt;Controller&lt;/i&gt; name)
and placing that subclass in the Controllers folder of our MVC project.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If
we wanted to call a controller named “David”, we would create a &lt;i style="mso-bidi-font-style: normal"&gt;System.Web.Mvc.Controller&lt;/i&gt; class
named “DavidController” into the &lt;i style="mso-bidi-font-style: normal"&gt;Controllers&lt;/i&gt; folder.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This
process is known as “convention over configuration”, meaning that the framework knows
where to find code based on the names we use.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Let’s look closely at the &lt;i style="mso-bidi-font-style: normal"&gt;Index &lt;/i&gt;method.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Recall
that the method in the controller is the &lt;i style="mso-bidi-font-style: normal"&gt;Action&lt;/i&gt; that
is specified in the URL.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;So the &lt;i style="mso-bidi-font-style: normal"&gt;Index&lt;/i&gt; method
will be called if the &lt;i style="mso-bidi-font-style: normal"&gt;Index&lt;/i&gt; action is specified. &lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;i style="mso-bidi-font-style: normal"&gt;ViewData&lt;/i&gt; is
a dictionary collection that is a property of every &lt;i style="mso-bidi-font-style: normal"&gt;Controller&lt;/i&gt; object.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;We
can add or update items in this collection by syntax such as 
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;ViewData[&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Title"&lt;/span&gt;&lt;font color=#000000&gt;]
= &lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Home Page"&lt;/span&gt;&lt;font color=#000000&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;By placing items in this collection, we make
them available to the view when it is called.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;The view (remember this is the UI that the
user will see) is returned from this method.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
following line returns the default view.&lt;br&gt;
&lt;/font&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;return&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; View();&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;We know it is the default view because the
statement did not specify the name of the view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
default view has the same name as the Action called. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;In
this case, we are returning the &lt;i style="mso-bidi-font-style: normal"&gt;Index&lt;/i&gt; view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Once
again, MVC uses conventions to determine where to find the view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;All
views associated with a given controller are stored in a subfolder named for that
controller beneath the &lt;i style="mso-bidi-font-style: normal"&gt;Views&lt;/i&gt; folder.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In
this case, we are using the Home controller, so we look for views in the &lt;i style="mso-bidi-font-style: normal"&gt;Views\Home&lt;/i&gt; folder
of the project.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The view itself is a
file with the same name as the view and with an extension of “.aspx” or “.ascx”.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In
this case, we are looking for the default view (Index) of the Home controller.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;MVC
renders the page &lt;i style="mso-bidi-font-style: normal"&gt;Views\Home\Index.aspx&lt;/i&gt; for
this view.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Again, the developer uses
naming conventions to tell the framework where to find items.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000&gt;&lt;font size=3 face=Calibri&gt;Open Index.aspx.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Notice
it displays the message stored in the &lt;i style="mso-bidi-font-style: normal"&gt;ViewData&lt;/i&gt; dictionary
by the controller.&lt;br&gt;
&lt;/font&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-no-proof: yes; mso-highlight: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;/font&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; Html.Encode(ViewData[&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Message"&lt;/span&gt;&lt;font color=#000000&gt;]) &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;However, it contains no other code, because
all logic is handled by the controller.&lt;/font&gt;
&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color=#4f81bd size=4 face=Cambria&gt;Conclusion&lt;/font&gt;
&lt;/h2&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;Creating a new ASP.Net MVC project is as easy
as creating any other Visual Studio project.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Learning
the paradigm that the MVC framework uses can be a challenge; but the samples created
automatically with a new project can ease that learning curve.&lt;/font&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;
&lt;font color=#000000 size=3 face=Calibri&gt;In the next article, we will add a new controller
and view to a project.&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=955be66f-d47d-418f-9f1d-9c740e395960" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,955be66f-d47d-418f-9f1d-9c740e395960.aspx</comments>
      <category>.Net</category>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=5ef48d87-0c64-4f08-a6d1-6de88a0ddd92</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,5ef48d87-0c64-4f08-a6d1-6de88a0ddd92.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,5ef48d87-0c64-4f08-a6d1-6de88a0ddd92.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5ef48d87-0c64-4f08-a6d1-6de88a0ddd92</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The Model-View-Controller (MVC) design pattern has existed for years.  (<a href="http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html" target="_blank">http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html</a>) 
ASP.Net developers have been implementing it for years either through their own custom
code or via third-party frameworks such as Monorail (<a href="http://www.castleproject.org/monorail/index.html" target="_blank">http://www.castleproject.org/monorail/index.html</a>).
</p>
        <p>
Recently, Microsoft released the ASP.Net MVC framework to give web developers the
option of using this design pattern without the need for a lot of “plumbing” code
or the use of a third-party framework.
</p>
        <p>
The Model-View-Controller design pattern splits an application into three distinct
parts called (you guessed it) “Models”, “Views” and “Controllers”.  
</p>
        <blockquote style="MARGIN-RIGHT: 0px" dir="ltr">
          <p>
A <em>Model </em>represents the stateful data in an application.  These are often
represented as objects such as “Customer” and “Employee” that represent an abstract
business object.  For persistent data, the Model may save and retrieve data to
and from a database.  Public properties of these objects (for example, “LastName”
or “HireDate”) represent their state at any give time.  The model objects have
no visual representation and no knowledge of how they will be displayed on screen.  
</p>
          <p>
A <em>View </em>is the application’s user interface (UI).  In a web application,
this is the web page that the user sees and clicks and interacts with directly. 
The View can display data but it has no knowledge of where the data it displays comes
from.
</p>
          <p>
A <em>Controller </em>is the brains of your application.  It links the Model
to the View.  It handles communication between the other two parts of the application. 
It is smart enough to detect when a data needs to be retrieved (from the model) and
refreshed (in the view).  It sends updated data from the view back to the model
so that the model can persist it.  
</p>
        </blockquote>
        <p dir="ltr">
Below is Trygve M. H. Reenskaug’s diagram of the relationship between these thee parts.<br /><a href="http://heim.ifi.uio.no/~trygver/themes/mvc/MVC-2006.gif" target="_pix"><img style="WIDTH: 401px; HEIGHT: 176px" src="http://heim.ifi.uio.no/~trygver/themes/mvc/MVC-2006.gif" width="432" height="203" /></a><br />
    <strong>Figure 1</strong></p>
        <p>
This separation of the various concerns of the application encourages developers to
create loosely-coupled components.
</p>
        <p>
Much of the communication to the controller occurs by raising events in the view,
which keeps the controller loosely coupled from the other parts.  However the
real advantage of the MVC pattern is that, because they only communicate through the
controller, the model and view are very loosely coupled.  This provides the following
advantages to an MVC application.
</p>
        <ul>
          <li>
Loosely-coupled applications have fewer dependencies, making it easier to switch the
user interface or backend at a later time. 
</li>
          <li>
Applications can be tested more easily, because so little code is in the view. 
We can test our code by writing unit tests against the controller.</li>
        </ul>
        <p>
In the next article, we will look at how to create a Microsoft ASP.Net MVC application.
</p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=5ef48d87-0c64-4f08-a6d1-6de88a0ddd92" />
      </body>
      <title>Overview of Microsoft ASP.Net MVC</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,5ef48d87-0c64-4f08-a6d1-6de88a0ddd92.aspx</guid>
      <link>http://www.davidgiard.com/2008/08/17/OverviewOfMicrosoftASPNetMVC.aspx</link>
      <pubDate>Sun, 17 Aug 2008 13:03:21 GMT</pubDate>
      <description>&lt;p&gt;
The Model-View-Controller (MVC) design pattern has existed for years.&amp;nbsp; (&lt;a href="http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html" target=_blank&gt;http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html&lt;/a&gt;)&amp;nbsp;
ASP.Net developers have been implementing it for years either through their own custom
code or via third-party frameworks such as Monorail (&lt;a href="http://www.castleproject.org/monorail/index.html" target=_blank&gt;http://www.castleproject.org/monorail/index.html&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
Recently, Microsoft released the ASP.Net MVC framework to give web developers the
option of using this design pattern without the need for a lot of “plumbing” code
or the use of a third-party framework.
&lt;/p&gt;
&lt;p&gt;
The Model-View-Controller design pattern splits an application into three distinct
parts called (you guessed it) “Models”, “Views” and “Controllers”.&amp;nbsp; 
&lt;/p&gt;
&lt;blockquote style="MARGIN-RIGHT: 0px" dir=ltr&gt; 
&lt;p&gt;
A &lt;em&gt;Model &lt;/em&gt;represents the stateful data in an application.&amp;nbsp; These are often
represented as objects such as “Customer” and “Employee” that represent an abstract
business object.&amp;nbsp; For persistent data, the Model may save and retrieve data to
and from a database.&amp;nbsp; Public properties of these objects (for example, “LastName”
or “HireDate”) represent their state at any give time.&amp;nbsp; The model objects have
no visual representation and no knowledge of how they will be displayed on screen.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
A &lt;em&gt;View &lt;/em&gt;is the application’s user interface (UI).&amp;nbsp; In a web application,
this is the web page that the user sees and clicks and interacts with directly.&amp;nbsp;
The View can display data but it has no knowledge of where the data it displays comes
from.
&lt;/p&gt;
&lt;p&gt;
A &lt;em&gt;Controller &lt;/em&gt;is the brains of your application.&amp;nbsp; It links the Model
to the View.&amp;nbsp; It handles communication between the other two parts of the application.&amp;nbsp;
It is smart enough to detect when a data needs to be retrieved (from the model) and
refreshed (in the view).&amp;nbsp; It sends updated data from the view back to the model
so that the model can persist it.&amp;nbsp; 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p dir=ltr&gt;
Below is Trygve M. H. Reenskaug’s diagram of the relationship between these thee parts.&lt;br&gt;
&lt;a href="http://heim.ifi.uio.no/~trygver/themes/mvc/MVC-2006.gif" target=_pix&gt;&lt;img style="WIDTH: 401px; HEIGHT: 176px" src="http://heim.ifi.uio.no/~trygver/themes/mvc/MVC-2006.gif" width=432 height=203&gt; &lt;/a&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;Figure 1&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This separation of the various concerns of the application encourages developers to
create loosely-coupled components.
&lt;/p&gt;
&lt;p&gt;
Much of the communication to the controller occurs by raising events in the view,
which keeps the controller loosely coupled from the other parts.&amp;nbsp; However the
real advantage of the MVC pattern is that, because they only communicate through the
controller, the model and view are very loosely coupled.&amp;nbsp; This provides the following
advantages to an MVC application.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Loosely-coupled applications have fewer dependencies, making it easier to switch the
user interface or backend at a later time. 
&lt;li&gt;
Applications can be tested more easily, because so little code is in the view.&amp;nbsp;
We can test our code by writing unit tests against the controller.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In the next article, we will look at how to create a Microsoft ASP.Net MVC application.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=5ef48d87-0c64-4f08-a6d1-6de88a0ddd92" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,5ef48d87-0c64-4f08-a6d1-6de88a0ddd92.aspx</comments>
      <category>.Net</category>
      <category>ASP.NET</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=ff7080d5-e3cb-4c37-b54d-6f8de95cf845</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,ff7080d5-e3cb-4c37-b54d-6f8de95cf845.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,ff7080d5-e3cb-4c37-b54d-6f8de95cf845.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ff7080d5-e3cb-4c37-b54d-6f8de95cf845</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h4>Binding to a GridView
</h4>
        <p>
ASP.Net data binding is a great technology for developers who want to create interactive
web applications without writing a lot of code. For example, a developer can drop
a GridView and a DataObject onto a web form, set a few properties and have a fully
editable grid, allowing users to easily view and update data.  
</p>
        <p>
Even sorting the grid data can be performed without writing any code.  Just set
the GridView's <em>AllowSorting </em>property to "true" and set the <em>SortExpression </em>property
of any "sortable" column.  
</p>
        <pre>
          <p>
            <font color="#0000ff" size="2">&lt;</font>
            <font color="#800000" size="2">asp</font>
            <font color="#0000ff" size="2">:</font>
            <font color="#800000" size="2">GridView</font>
            <font size="2">
              <br />
            </font>
            <font color="#ff0000" size="2">   ID</font>
            <font color="#0000ff" size="2">="GridView1"</font>
            <font size="2">
              <br />
            </font>
            <font color="#ff0000" size="2">   runat</font>
            <font color="#0000ff" size="2">="server"</font>
            <font size="2">
              <br />
            </font>
            <font color="#ff0000" size="2">   AllowSorting</font>
            <font color="#0000ff" size="2">="true"</font>
          </p>
          <p>
          </p>
          <p>
            <font color="#0000ff" size="2">...</font>
          </p>
          <font color="#0000ff" size="2">
            <font size="2">
              <p>
              </p>
            </font>
            <font color="#0000ff" size="2">   &lt;</font>
            <font color="#800000" size="2">asp</font>
            <font color="#0000ff" size="2">:</font>
            <font color="#800000" size="2">BoundField</font>
            <font size="2">
              <br />
            </font>
            <font color="#ff0000" size="2">      DataField</font>
            <font color="#0000ff" size="2">="Name"</font>
            <font size="2">
              <br />
            </font>
            <font color="#ff0000" size="2">      HeaderText</font>
            <font color="#0000ff" size="2">="Product
Name"</font>
            <font size="2">
              <br />
            </font>
            <font color="#ff0000" size="2">      SortExpression</font>
            <font color="#0000ff" size="2">="Name"</font>
            <font size="2">
            </font>
            <font color="#0000ff" size="2">/&gt;
... 
</font>
          </font>
        </pre>
        <p>
        </p>
        <p>
        </p>
        <p>
By default, the grid renders a link at the top of each sortable column.  Clicking
this link toggles the sort order between 3 states: Ascending, Descending and No Sort.  
</p>
        <p>
          <img border="1" src="http://www.davidgiard.com/content/binary/GridSort01.bmp" />
          <br />
        </p>
        <h4>Sorting Limitations
</h4>
        <p>
But there is a "Gotcha".  The GridView can be bound to any set of data - that
is, to any object that implements the System.Collections.IEnumerable interface. 
This includes a DataTable, ArrayList, List and HashTable, among others.  However
the automatic sorting only works when binding to a DataTable.
</p>
        <p>
Personally, I prefer to work with and bind to generic Lists.  A List is more
flexible than a DataTable and does a better job of abstracting the user interface
from the back-end data source, making it easier to swap out one or the other.
</p>
        <p>
But by binding to a List, I sacrifice the automatic sorting that happens when I bind
to a DataTable.  Fortunately, it doesn't take a lot of code to implement sorting
on a GridView bound to a generic List.
</p>
        <h4>How to sort a GridView bound to a List
</h4>
        <p>
First, we set the GridView <em>AllowSorting </em>property and each column's <em>SortExpression </em>property
as described above.  This provides "sort" links at the top of each column. 
Unfortunately these links will not work properly - in fact, clicking them will generate
an error.
</p>
        <p>
To get this to work, you must do the following
</p>
        <ol>
          <li>
Add an extra "sortby" parameter of type string to your Select method. 
</li>
          <li>
Add code to your sort method to sort the list before returning it (more on this later) 
</li>
          <li>
Add a <em>SortParameterName </em>attribute to your ObjectDataSource.  The value
of this parameter should be the same as the parameter you added to your Select method.</li>
        </ol>
        <p>
By setting the <em>SortParameterName </em>attribute, we are telling ASP.Net to pass
sorting information to the Select method and which parameter to pass it to. 
The Select method gets called when the grid loads or refreshes and whenever the user
clicks the "sort" links at the top of each column.  Most of the time, the value
passed to the sortby parameter is an empty string (indicating no sort order), but
if the user clicks a "sort" link, this parameter will contain one of the following
three values
</p>
        <ul>
          <li>
"&lt;SortField&gt; ASC" 
</li>
          <li>
"&lt;SortField&gt; DESC" 
</li>
          <li>
""</li>
        </ul>
        <p>
where &lt;SortField&gt; is the string specified in the SortExpression attribute of
the column clicked.  With each click, the grid column cycles its sort between
ascending order, descending order, and no sort.  The parameter value passed depends
on which is currently the active sort.  
</p>
        <pre>
          <font size="2">
            <p>
            </p>
          </font>
          <font color="#0000ff" size="2">&lt;</font>
          <font color="#800000" size="2">asp</font>
          <font color="#0000ff" size="2">:</font>
          <font color="#800000" size="2">ObjectDataSource</font>
          <font size="2">
          </font>
          <font color="#ff0000" size="2">ID</font>
          <font color="#0000ff" size="2">="ProductObjectDataSource"</font>
          <font size="2">
          </font>
          <font color="#ff0000" size="2">runat</font>
          <font color="#0000ff" size="2">="server"</font>
          <font size="2"> <br /></font>
          <font color="#ff0000" size="2">      SelectMethod</font>
          <font color="#0000ff" size="2">="GetProductsList"<br /></font>
          <font color="#ff0000" size="2">      TypeName</font>
          <font color="#0000ff" size="2">="DemoGridBusLayer.NWindBL"<br /></font>
          <font color="#ff0000" size="2">      SortParameterName</font>
          <font color="#0000ff" size="2">="sortBy"&gt;<br /></font>
          <font color="#0000ff" size="2">&lt;/</font>
          <font color="#800000" size="2">asp</font>
          <font color="#0000ff" size="2">:</font>
          <font color="#800000" size="2">ObjectDataSource</font>
          <font color="#0000ff" size="2">&gt;
</font>
        </pre>
        <p>
Now, how do we sort a List?  More specifically, how do we sort a list when we
don't know in advance on which column we are sorting or in which direction (ascending
or descending)?  
</p>
        <p>
A List has a Sort method, so we can call that.  But what does it mean to sort
a list of objects?  An object has properties and we can sort on any one (or more)
of those properties, as long as the property is of a type that can be sorted. 
We need to specify on which object property we will be sorting.  To do this,
we use an overload of the List.Sort method that accepts an IComparer object. 
IComparer has a Compare method that tells the Sort method how to order each pair of
objects in the list.  We can create a class that implements IComparer, override
the Compare method and use reflection to determine at runtime on which property to
sort.  The name of the property and the sort order (Ascending or Descending)
can be passed into the class constructor.  
</p>
        <p>
The code for this class (named GenericComparer) below:
</p>
        <p>
        </p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System;<br /><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System.Collections.Generic;<br /><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System.Collections;<br /><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System.Text;<br /><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">using</span> System.Reflection;<br /><br /><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">namespace</span> DemoGridBusLayer<br />
{<br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;summary&gt;</span><br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
This class is used to compare any </span><br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
type(property) of a class for sorting.</span><br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
This class automatically fetches the </span><br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
type of the property and compares.</span><br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/summary&gt;</span><br />
    <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">sealed</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">class</span> GenericComparer&lt;T&gt;
: IComparer&lt;T&gt;<br />
    {<br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">enum</span> SortOrder
{ Ascending, Descending };<br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">#region</span> Constructors<br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> GenericComparer(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> sortColumn,
SortOrder sortingOrder)<br />
        {<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">this</span>._sortColumn <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> sortColumn;<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">this</span>._sortingOrder <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> sortingOrder;<br />
        }<br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
Constructor when passing in a sort expression containing both the Sort Column and
the Sort Order</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
e.g., "BPCode ASC".</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;param name="sortExpression"&gt;&lt;/param&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;remarks&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
This constructor is useful when using this with the ASP.NET ObjectDataSource, </span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
which passes the SortParameterName in this format</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/remarks&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> GenericComparer(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> sortExpression)<br />
        {<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span>[]
sortExprArray <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> sortExpression.Split(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"
"</span>.ToCharArray());<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> sortColumn <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> sortExprArray[0];<br />
            SortOrder sortingOrder;<br />
            sortingOrder <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> SortOrder.Ascending;<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (sortExprArray.Length
&gt; 1)<br />
            {<br />
                <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (sortExprArray[1].ToUpper()
== <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"DESC"</span>)<br />
               
{<br />
                   
sortingOrder <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> SortOrder.Descending;<br />
               
}<br />
            }<br /><br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">this</span>._sortColumn <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> sortColumn;<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">this</span>._sortingOrder <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> sortingOrder;<br />
        }<br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">#endregion</span><br /><br /><br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">#region</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> properties<br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
Column Name(public property of the class) to be sorted.</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">private</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> _sortColumn;<br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> SortColumn<br />
        {<br />
            get { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> _sortColumn;
}<br />
        }<br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
Sorting order (ASC OR DESC)</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">private</span> SortOrder
_sortingOrder;<br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span> SortOrder
SortingOrder<br />
        {<br />
            get { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> _sortingOrder;
}<br />
        }<br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">#endregion</span><br /><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
Compare two objects of the same class, </span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
based on the value of a given property</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/summary&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;param name="x"&gt;First Object&lt;/param&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;param name="y"&gt;Second Object&lt;/param&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;returns&gt;int&lt;/returns&gt;</span><br />
        <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">int</span> Compare(T
x, T y)<br />
        {<br /><br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
User reflection to get the property</span><br />
            PropertyInfo propertyInfo <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">typeof</span>(T).GetProperty(_sortColumn);<br /><br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Cast the property to IComparable, so we can use the built-in compare.</span><br />
            IComparable obj1 <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> (IComparable)propertyInfo.GetValue(x, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>);<br />
            IComparable obj2 <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> (IComparable)propertyInfo.GetValue(y, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>);<br /><br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Order depends on Asc vs Desc.</span><br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (_sortingOrder
== SortOrder.Ascending)<br />
            {<br />
                <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> (obj1.CompareTo(obj2));<br />
            }<br />
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">else</span><br />
            {<br />
                <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> (obj2.CompareTo(obj1));<br />
            }<br />
        }<br />
    }<br />
}</span>
          <p>
          </p>
          <p>
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
              <br />
            </span>
          </p>
          <p>
          </p>
        </pre>
Within our select method, we can call the List's Sort method and pass in an instance
of the GenericComparer class, specifying on which column and in which direction to
sort the list.  The SelectMethod is shown below.  (The details of querying
a database and storing results into a List of objects is omitted.) 
<p></p><pre><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;summary&gt;</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
Get a sorted list of all products</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;/summary&gt;</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;param name="sortBy"&gt;&lt;/param&gt;</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">///
&lt;returns&gt;&lt;/returns&gt;</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">static</span> List&lt;Product&gt;
GetProductsList(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> sortBy)
{ <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Get a list of Business Processes</span> List&lt;Product&gt; prodList <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> GetProductsList(); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Sort list</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (sortBy
!<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">""</span>)
{ GenericComparer&lt;Product&gt; cmp <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> GenericComparer&lt;Product&gt;(sortBy);
prodList.Sort(cmp); } <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> prodList;
} } } </span></pre><p>
With a small amount of code, we can enable sorting of a List of objects bound to a
GridView in the same way that sorting is enabled for a DataTable bound to a GridView.
</p><h4>Demo
</h4><p>
You can download the entire sample described in this article here: <a href="http://www.davidgiard.com/content/binary/DemoGridSort.zip">DemoGridSort.zip
(39.63 KB)</a>.  You will need the AdventureWorks sample SQL Server database
for this demo.<br /></p><img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ff7080d5-e3cb-4c37-b54d-6f8de95cf845" /></body>
      <title>Sorting a GridView bound to a generic List</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,ff7080d5-e3cb-4c37-b54d-6f8de95cf845.aspx</guid>
      <link>http://www.davidgiard.com/2008/06/26/SortingAGridViewBoundToAGenericList.aspx</link>
      <pubDate>Thu, 26 Jun 2008 16:05:33 GMT</pubDate>
      <description>&lt;h4&gt;Binding to a GridView
&lt;/h4&gt;
&lt;p&gt;
ASP.Net data binding is a great technology for developers who want to create interactive
web applications without writing a lot of code. For example, a developer can drop
a GridView and a DataObject onto a web form, set a few properties and have a fully
editable grid, allowing users to easily view and update data.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Even sorting the grid data can be performed without writing any code.&amp;nbsp; Just set
the GridView's &lt;em&gt;AllowSorting &lt;/em&gt;property to "true" and set the &lt;em&gt;SortExpression &lt;/em&gt;property
of any "sortable" column.&amp;nbsp; 
&lt;/p&gt;
&lt;pre&gt;
&lt;p&gt;
&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;GridView&lt;/font&gt;&lt;font size=2&gt; 
&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ID&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="GridView1"&lt;/font&gt;&lt;font size=2&gt; 
&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;runat&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="server"&lt;/font&gt;&lt;font size=2&gt; 
&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;AllowSorting&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="true"&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#0000ff size=2&gt;...&lt;/font&gt;
&lt;/p&gt;
&lt;font color=#0000ff size=2&gt;&lt;font size=2&gt;
&lt;p&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;BoundField&lt;/font&gt;&lt;font size=2&gt; 
&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DataField&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Name"&lt;/font&gt;&lt;font size=2&gt; 
&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;HeaderText&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Product
Name"&lt;/font&gt;&lt;font size=2&gt; 
&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SortExpression&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Name"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt;&gt;
... 
&lt;/pre&gt;
&gt; 
&lt;p&gt;
&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
By default, the grid renders a link at the top of each sortable column.&amp;nbsp; Clicking
this link toggles the sort order between 3 states: Ascending, Descending and No Sort.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
&lt;img border=1 src="http://www.davidgiard.com/content/binary/GridSort01.bmp"&gt; 
&lt;br&gt;
&lt;/p&gt;
&lt;h4&gt;Sorting Limitations
&lt;/h4&gt;
&lt;p&gt;
But there is a "Gotcha".&amp;nbsp; The GridView can be bound to any set of data - that
is, to any object that implements the System.Collections.IEnumerable interface.&amp;nbsp;
This includes a DataTable, ArrayList, List and HashTable, among others.&amp;nbsp; However
the automatic sorting only works when binding to a DataTable.
&lt;/p&gt;
&lt;p&gt;
Personally, I prefer to work with and bind to generic Lists.&amp;nbsp; A List is more
flexible than a DataTable and does a better job of abstracting the user interface
from the back-end data source, making it easier to swap out one or the other.
&lt;/p&gt;
&lt;p&gt;
But by binding to a List, I sacrifice the automatic sorting that happens when I bind
to a DataTable.&amp;nbsp; Fortunately, it doesn't take a lot of code to implement sorting
on a GridView bound to a generic List.
&lt;/p&gt;
&lt;h4&gt;How to sort a GridView bound to a List
&lt;/h4&gt;
&lt;p&gt;
First, we set the GridView &lt;em&gt;AllowSorting &lt;/em&gt;property and each column's &lt;em&gt;SortExpression &lt;/em&gt;property
as described above.&amp;nbsp; This provides "sort" links at the top of each column.&amp;nbsp;
Unfortunately these links will not work properly - in fact, clicking them will generate
an error.
&lt;/p&gt;
&lt;p&gt;
To get this to work, you must do the following
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Add an extra "sortby" parameter of type string to your Select method. 
&lt;li&gt;
Add code to your sort method to sort the list before returning it (more on this later) 
&lt;li&gt;
Add a &lt;em&gt;SortParameterName &lt;/em&gt;attribute to your ObjectDataSource.&amp;nbsp; The value
of this parameter should be the same as the parameter you added to your Select method.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
By setting the &lt;em&gt;SortParameterName &lt;/em&gt;attribute, we are telling ASP.Net to pass
sorting information to the Select method and which parameter to pass it to.&amp;nbsp;
The Select method gets called when the grid loads or refreshes and whenever the user
clicks the "sort" links at the top of each column.&amp;nbsp; Most of the time, the value
passed to the sortby parameter is an empty string (indicating no sort order), but
if the user clicks a "sort" link, this parameter will contain one of the following
three values
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
"&amp;lt;SortField&amp;gt; ASC" 
&lt;li&gt;
"&amp;lt;SortField&amp;gt; DESC" 
&lt;li&gt;
""&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
where &amp;lt;SortField&amp;gt; is the string specified in the SortExpression attribute of
the column clicked.&amp;nbsp; With each click, the grid column cycles its sort between
ascending order, descending order, and no sort.&amp;nbsp; The parameter value passed depends
on which is currently the active sort.&amp;nbsp; 
&lt;/p&gt;
&lt;pre&gt;&lt;font size=2&gt; 
&lt;p&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;ObjectDataSource&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;ID&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="ProductObjectDataSource"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;runat&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="server"&lt;/font&gt;&lt;font size=2&gt;&amp;nbsp;&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SelectMethod&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="GetProductsList"&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TypeName&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="DemoGridBusLayer.NWindBL"&lt;br&gt;
&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SortParameterName&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="sortBy"&amp;gt;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;lt;/&lt;/font&gt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;ObjectDataSource&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;gt;&gt;
&lt;/font&gt; &lt;/pre&gt;
&lt;p&gt;
Now, how do we sort a List?&amp;nbsp; More specifically, how do we sort a list when we
don't know in advance on which column we are sorting or in which direction (ascending
or descending)?&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
A List has a Sort method, so we can call that.&amp;nbsp; But what does it mean to sort
a list of objects?&amp;nbsp; An object has properties and we can sort on any one (or more)
of those properties, as long as the property is of a type that can be sorted.&amp;nbsp;
We need to specify on which object property we will be sorting.&amp;nbsp; To do this,
we use an overload of the List.Sort method that accepts an IComparer object.&amp;nbsp;
IComparer has a Compare method that tells the Sort method how to order each pair of
objects in the list.&amp;nbsp; We can create a class that implements IComparer, override
the Compare method and use reflection to determine at runtime on which property to
sort.&amp;nbsp; The name of the property and the sort order (Ascending or Descending)
can be passed into the class constructor.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
The code for this class (named GenericComparer) below:
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System;&lt;br&gt;
&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;
&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System.Collections;&lt;br&gt;
&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System.Text;&lt;br&gt;
&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;using&lt;/span&gt; System.Reflection;&lt;br&gt;
&lt;br&gt;
&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;namespace&lt;/span&gt; DemoGridBusLayer&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
This class is used to compare any &lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
type(property) of a class for sorting.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
This class automatically fetches the &lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
type of the property and compares.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;sealed&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;class&lt;/span&gt; GenericComparer&amp;lt;T&amp;gt;
: IComparer&amp;lt;T&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;enum&lt;/span&gt; SortOrder
{ Ascending, Descending };&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;#region&lt;/span&gt; Constructors&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; GenericComparer(&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; sortColumn,
SortOrder sortingOrder)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;this&lt;/span&gt;._sortColumn &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; sortColumn;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;this&lt;/span&gt;._sortingOrder &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; sortingOrder;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
Constructor when passing in a sort expression containing both the Sort Column and
the Sort Order&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
e.g., "BPCode ASC".&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;param name="sortExpression"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;remarks&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
This constructor is useful when using this with the ASP.NET ObjectDataSource, &lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
which passes the SortParameterName in this format&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; GenericComparer(&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; sortExpression)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt;[]
sortExprArray &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; sortExpression.Split(&lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"
"&lt;/span&gt;.ToCharArray());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; sortColumn &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; sortExprArray[0];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SortOrder sortingOrder;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortingOrder &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; SortOrder.Ascending;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;if&lt;/span&gt; (sortExprArray.Length
&amp;gt; 1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;if&lt;/span&gt; (sortExprArray[1].ToUpper()
== &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;"DESC"&lt;/span&gt;)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
sortingOrder &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; SortOrder.Descending;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;this&lt;/span&gt;._sortColumn &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; sortColumn;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;this&lt;/span&gt;._sortingOrder &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; sortingOrder;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;#endregion&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;#region&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; properties&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
Column Name(public property of the class) to be sorted.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;private&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; _sortColumn;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; SortColumn&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; _sortColumn;
}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
Sorting order (ASC OR DESC)&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;private&lt;/span&gt; SortOrder
_sortingOrder;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; SortOrder
SortingOrder&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; _sortingOrder;
}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;#endregion&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
Compare two objects of the same class, &lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
based on the value of a given property&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;param name="x"&amp;gt;First Object&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;param name="y"&amp;gt;Second Object&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;returns&amp;gt;int&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;int&lt;/span&gt; Compare(T
x, T y)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
User reflection to get the property&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PropertyInfo propertyInfo &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;typeof&lt;/span&gt;(T).GetProperty(_sortColumn);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
Cast the property to IComparable, so we can use the built-in compare.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IComparable obj1 &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; (IComparable)propertyInfo.GetValue(x, &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;null&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IComparable obj2 &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; (IComparable)propertyInfo.GetValue(y, &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;null&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
Order depends on Asc vs Desc.&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;if&lt;/span&gt; (_sortingOrder
== SortOrder.Ascending)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; (obj1.CompareTo(obj2));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;else&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; (obj2.CompareTo(obj1));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;/span&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&gt; 
&lt;/p&gt;
&lt;/pre&gt;
Within our select method, we can call the List's Sort method and pass in an instance
of the GenericComparer class, specifying on which column and in which direction to
sort the list.&amp;nbsp; The SelectMethod is shown below.&amp;nbsp; (The details of querying
a database and storing results into a List of objects is omitted.) 
&lt;p&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px"&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
Get a sorted list of all products&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;param name="sortBy"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;///
&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;public&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;static&lt;/span&gt; List&amp;lt;Product&amp;gt;
GetProductsList(&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;string&lt;/span&gt; sortBy)
{ &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
Get a list of Business Processes&lt;/span&gt; List&amp;lt;Product&amp;gt; prodList &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; GetProductsList(); &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px"&gt;//
Sort list&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;if&lt;/span&gt; (sortBy
!&lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px"&gt;""&lt;/span&gt;)
{ GenericComparer&amp;lt;Product&amp;gt; cmp &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px"&gt;=&lt;/span&gt; &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;new&lt;/span&gt; GenericComparer&amp;lt;Product&amp;gt;(sortBy);
prodList.Sort(cmp); } &lt;span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px"&gt;return&lt;/span&gt; prodList;
} } } &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
With a small amount of code, we can enable sorting of a List of objects bound to a
GridView in the same way that sorting is enabled for a DataTable bound to a GridView.
&lt;/p&gt;
&lt;h4&gt;Demo
&lt;/h4&gt;
&lt;p&gt;
You can download the entire sample described in this article here: &lt;a href="http://www.davidgiard.com/content/binary/DemoGridSort.zip"&gt;DemoGridSort.zip
(39.63 KB)&lt;/a&gt;.&amp;nbsp; You will need the AdventureWorks sample SQL Server database
for this demo.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=ff7080d5-e3cb-4c37-b54d-6f8de95cf845" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,ff7080d5-e3cb-4c37-b54d-6f8de95cf845.aspx</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=6b81a664-d0e9-453e-b65c-3fc8f5c202d3</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,6b81a664-d0e9-453e-b65c-3fc8f5c202d3.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,6b81a664-d0e9-453e-b65c-3fc8f5c202d3.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6b81a664-d0e9-453e-b65c-3fc8f5c202d3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Did you know that every time an Ajax control performs a partial postpack, every
event in the life cycle of the control's containing page or pages fires?
</p>
        <p>
To me, this seems counterintuitive - There is no refresh of the containing page or
of the master page, yet the <em>Page_Load </em>of both events fire.
</p>
        <p>
I ran into it when I witnessed some unexpected behavior in a colleague's Ajax
control.  After some investigation I saw the behavior was caused by code in the <em>Page_Load </em>event
handler.  I thought this was a bug until I learned it was by design.  So
we ended up bracketing some of the <em>Page_Load </em>code, testing the value of <em>Page.IsPostBack </em>to
prevent code from running when it should not.
</p>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=6b81a664-d0e9-453e-b65c-3fc8f5c202d3" />
      </body>
      <title>Ajax controls and page events</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,6b81a664-d0e9-453e-b65c-3fc8f5c202d3.aspx</guid>
      <link>http://www.davidgiard.com/2008/06/24/AjaxControlsAndPageEvents.aspx</link>
      <pubDate>Tue, 24 Jun 2008 14:51:57 GMT</pubDate>
      <description>&lt;p&gt;
Did you know that every time an Ajax control&amp;nbsp;performs a partial postpack, every
event in the life cycle of the control's containing page or pages fires?
&lt;/p&gt;
&lt;p&gt;
To me, this seems counterintuitive - There is no refresh of the containing page or
of the master page, yet the &lt;em&gt;Page_Load &lt;/em&gt;of both events fire.
&lt;/p&gt;
&lt;p&gt;
I ran into it when I witnessed some&amp;nbsp;unexpected behavior in a colleague's Ajax
control.&amp;nbsp; After some investigation I saw the behavior was caused by code in the &lt;em&gt;Page_Load &lt;/em&gt;event
handler.&amp;nbsp; I thought this was a bug until I learned it was by design.&amp;nbsp; So
we ended up bracketing some of the &lt;em&gt;Page_Load &lt;/em&gt;code, testing the value of &lt;em&gt;Page.IsPostBack &lt;/em&gt;to
prevent code from running when it should not.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=6b81a664-d0e9-453e-b65c-3fc8f5c202d3" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,6b81a664-d0e9-453e-b65c-3fc8f5c202d3.aspx</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.davidgiard.com/Trackback.aspx?guid=58f62a28-1eb4-44ff-a637-fdd2fab003a3</trackback:ping>
      <pingback:server>http://www.davidgiard.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.davidgiard.com/PermaLink,guid,58f62a28-1eb4-44ff-a637-fdd2fab003a3.aspx</pingback:target>
      <dc:creator>David Giard</dc:creator>
      <wfw:comment>http://www.davidgiard.com/CommentView,guid,58f62a28-1eb4-44ff-a637-fdd2fab003a3.aspx</wfw:comment>
      <wfw:commentRss>http://www.davidgiard.com/SyndicationService.asmx/GetEntryCommentsRss?guid=58f62a28-1eb4-44ff-a637-fdd2fab003a3</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Scott Mitchell has an <a target="_blank" href="http://aspnet.4guysfromrolla.com/articles/101304-1.aspx">excellent
article</a> on <a target="_blank" href="http://www.4guysfromrolla.com/">4GuysFromRolla.com</a> about
how to use ASP.Net to prompt a user to save changes before leaving a page.  It
is part of a series he wrote back in 2004 but it is still relevant today.  The
only change you should make today is that he calls methods of the Page class (IsStartupScriptRegistered,
RegisterClientScriptBlock, RegisterArrayDeclaration) and these methods are depcrecated
and replaced by the same methods in the Page.ClientScript class.
</p>
        <p>
Scott's code initializes a client-side array with a list of inputs to monitor
and the initial value of each input.  He then uses the <em>onbeforeunload</em> event
to check if the data in any of these inputs has changed and displays a confirmation
prompt if any data hase changed.  This event fires even if the user attempts
to exit the form by closing the browser or clicking the brower's 'Back' button.
</p>
        <p>
I liked Scott's approach so much that I took his public methods and moved them into
a base class that inherits from System.Web.UI.Page and I inherit all my web pages
from this class.  Now in each Page_Load, I can call methods of the base class
to register controls that, if changed, will mark page data as dirty and prompt the
user when he attempts to navigate away without saving.
</p>
        <p>
I noticed that the "initial state" of controls were reset whenever a postback occurred,
so I created a method "MarkDataAsDirty" that could be called when a control's "autopostback"
fired but when the user is not finished entering data.  This sets a hidden
form on the client that is checked in the onbeforeunload method to determine if data
has changed.
</p>
        <p>
I also made the methods public so they could be accessible to any user controls dropped
on a page.  And I created the utility method <em>RegisterForConfirmUnsavedChanges </em>that
registers the most common controls on the page using Scott's original methods.
</p>
        <p>
I've included a sample ASP.NET web site in which every page inherits from a base page
and methods of that base class are called to implement this functionality.
</p>
        <p>
 
</p>
        <a href="http://www.davidgiard.com/content/binary/ConfirmSaveSite1.zip">ConfirmSaveSite1.zip
(9.51 KB)</a>
        <img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=58f62a28-1eb4-44ff-a637-fdd2fab003a3" />
      </body>
      <title>Prompting user to save changes when navigating away from a page</title>
      <guid isPermaLink="false">http://www.davidgiard.com/PermaLink,guid,58f62a28-1eb4-44ff-a637-fdd2fab003a3.aspx</guid>
      <link>http://www.davidgiard.com/2008/02/21/PromptingUserToSaveChangesWhenNavigatingAwayFromAPage.aspx</link>
      <pubDate>Thu, 21 Feb 2008 16:15:33 GMT</pubDate>
      <description>&lt;p&gt;
Scott Mitchell has an &lt;a target="_blank" href="http://aspnet.4guysfromrolla.com/articles/101304-1.aspx"&gt;excellent
article&lt;/a&gt; on &lt;a target="_blank" href="http://www.4guysfromrolla.com/"&gt;4GuysFromRolla.com&lt;/a&gt; about
how to use ASP.Net to prompt a user to save changes before leaving a page.&amp;nbsp; It
is part of a series he wrote back in 2004 but it is still relevant today.&amp;nbsp; The
only change you should make today is that he calls methods of the Page class (IsStartupScriptRegistered,
RegisterClientScriptBlock, RegisterArrayDeclaration) and these methods are depcrecated
and replaced by the same methods in the Page.ClientScript class.
&lt;/p&gt;
&lt;p&gt;
Scott's code&amp;nbsp;initializes a client-side array with a list of inputs to monitor
and the initial value of each input.&amp;nbsp; He then uses the &lt;em&gt;onbeforeunload&lt;/em&gt; event
to check if the data in any of these inputs has changed and displays a confirmation
prompt if any&amp;nbsp;data hase changed.&amp;nbsp; This event fires even if the user attempts
to exit the form by closing the browser or clicking the brower's 'Back' button.
&lt;/p&gt;
&lt;p&gt;
I liked Scott's approach so much that I took his public methods and moved them into
a base class that inherits from System.Web.UI.Page and I inherit all my web pages
from this class.&amp;nbsp; Now in each Page_Load, I can call methods of the base class
to register controls that, if changed, will mark page data as dirty and prompt the
user when he attempts to navigate away without saving.
&lt;/p&gt;
&lt;p&gt;
I noticed that the "initial state" of controls were reset whenever a postback occurred,
so I created a method "MarkDataAsDirty" that could be called when a control's "autopostback"
fired but when the user is not finished entering data.&amp;nbsp; This sets&amp;nbsp;a hidden
form on the client that is checked in the onbeforeunload method to determine if data
has changed.
&lt;/p&gt;
&lt;p&gt;
I also made the methods public so they could be accessible to any user controls dropped
on a page.&amp;nbsp; And I created the utility method &lt;em&gt;RegisterForConfirmUnsavedChanges &lt;/em&gt;that
registers the most common controls on the page using Scott's original methods.
&lt;/p&gt;
&lt;p&gt;
I've included a sample ASP.NET web site in which every page inherits from a base page
and methods of that base class are called to implement this functionality.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;a href="http://www.davidgiard.com/content/binary/ConfirmSaveSite1.zip"&gt;ConfirmSaveSite1.zip
(9.51 KB)&lt;/a&gt;&lt;img width="0" height="0" src="http://www.davidgiard.com/aggbug.ashx?id=58f62a28-1eb4-44ff-a637-fdd2fab003a3" /&gt;</description>
      <comments>http://www.davidgiard.com/CommentView,guid,58f62a28-1eb4-44ff-a637-fdd2fab003a3.aspx</comments>
      <category>ASP.NET</category>
    </item>
  </channel>
</rss>