<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Craig Shoemaker : ASP.NET</title><link>http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Lazy Loading JavaScript Files Using ASP.NET AJAX Script Loader</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/12/09/lazy-loading-javascript-files-using-asp-net-ajax-script-loader.aspx</link><pubDate>Wed, 09 Dec 2009 22:12:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7274856</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7274856</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/12/09/lazy-loading-javascript-files-using-asp-net-ajax-script-loader.aspx#comments</comments><description>&lt;p&gt;The &lt;a href="http://weblogs.asp.net/scottgu/archive/2009/10/15/announcing-microsoft-ajax-library-preview-6-and-the-microsoft-ajax-minifier.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2009/10/15/announcing-microsoft-ajax-library-preview-6-and-the-microsoft-ajax-minifier.aspx"&gt;ASP.NET AJAX Script Loader control&lt;/a&gt; will make your life easier. Gone are the days where you have to include a multi-line block of script includes on every web page. Gone are the days of double checking to make sure your script files are included in the right order. Now with the appropriate use of the Script Loader’s &lt;strong&gt;require&lt;/strong&gt; function gone are the days of having to load scripts on your page whether you need them or not.&lt;/p&gt;

&lt;p&gt;Since the Script Loader control programmatically loads scripts into the browser you get imperative control of when and where scripts are loaded. Consider a page that will only load the &lt;a href="http://blogs.visoftinc.com/archive/2009/04/28/ASP.NET-4.0-AJAX-Preview-4-Client-Templates.aspx" mce_href="http://blogs.visoftinc.com/archive/2009/04/28/ASP.NET-4.0-AJAX-Preview-4-Client-Templates.aspx"&gt;dataView scripts&lt;/a&gt; on to the page when a user tries to access an area of the page where an ASP.NET AJAX client template is used to display the data. The following code demonstrates how to accomplish this task.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;a href="http://polymorphicpodcast.com/examples/lazyloadscripts/" mce_href="http://polymorphicpodcast.com/examples/lazyloadscripts/"&gt;Make sure to see it in action by checking out the live working copy!&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Script&lt;/h3&gt;

&lt;pre style="border: 1px solid rgb(204, 204, 204); padding: 4px; background-color: rgb(238, 238, 238); font-size: 1.2em;"&gt;&amp;lt;script src="http://weblogs.asp.net/Scripts/MicrosoftAjax/start.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;

Sys.require(Sys.scripts.ComponentModel);

Sys.onReady(function()
{
    Sys.addHandler($get("bindButton"), "click", function()
    {
        $get("bindButton").disabled = true;
        Sys.require([Sys.components.dataView], function()
        {
            Sys.create.dataView("#dv", { data: colors });
        });
    });
});

var colors = [
   { Name: "Black" },
   { Name: "Blue" },
   { Name: "White" },
   { Name: "Green" }
];
&amp;lt;/script&amp;gt;&lt;/pre&gt;

&lt;h3&gt;Markup&lt;/h3&gt;

&lt;pre style="border: 1px solid rgb(204, 204, 204); padding: 4px; background-color: rgb(238, 238, 238); font-size: 1.2em;"&gt;&amp;lt;input type="button" value="Get Colors" id="bindButton" name="bindButton" /&amp;gt;
&amp;lt;ul id="dv" class="sys-template"&amp;gt;
    &amp;lt;li&amp;gt;{{Name}}&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;&lt;/pre&gt;

&lt;p&gt;Special thanks to &lt;a href="http://blogs.southworks.net/jdominguez/" mce_href="http://blogs.southworks.net/jdominguez/"&gt;Julian Dominguez&lt;/a&gt; (&lt;a href="http://twitter.com/juliandominguez" mce_href="http://twitter.com/juliandominguez"&gt;@juliandominguez&lt;/a&gt;) for helping me work out a few kinks in the first iteration of this code :)&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7274856" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/AJAX/default.aspx">AJAX</category></item><item><title>Presentation: ASP.NET AJAX 4 at Inland Empire .NET User Group</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/12/08/presentation-asp-net-ajax-4-at-inland-empire-net-user-group.aspx</link><pubDate>Wed, 09 Dec 2009 02:30:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7273889</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7273889</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/12/08/presentation-asp-net-ajax-4-at-inland-empire-net-user-group.aspx#comments</comments><description>&lt;p&gt;Thanks to everyone who came to my ASP.NET AJAX 4 talk at the &lt;a href="http://www.iedotnetug.org" mce_href="http://www.iedotnetug.org"&gt;Inland Empire .NET User Group&lt;/a&gt;. Special thanks to &lt;a href="http://www.duringlunch.com/" mce_href="http://www.duringlunch.com/"&gt;James Johnson&lt;/a&gt; (&lt;a href="http://twitter.com/latringo" mce_href="http://twitter.com/latringo"&gt;@latringo&lt;/a&gt;) for organizing such a great group! &lt;/p&gt;&lt;p&gt;Here is the code download for the talk:&amp;nbsp; &lt;a href="http://polymorphicpodcast.com/code/2009-12-08/ieug/ASPNETClientTemplates.zip" mce_href="http://polymorphicpodcast.com/code/2009-12-08/ieug/ASPNETClientTemplates.zip"&gt;ASPNETClientTemplates.zip&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7273889" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Presentation/default.aspx">Presentation</category></item><item><title>ASP.NET Simplicity and Performance with Scott Hunter</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/12/04/asp-net-simplicity-and-performance-with-scott-hunter.aspx</link><pubDate>Fri, 04 Dec 2009 16:28:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7270703</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7270703</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/12/04/asp-net-simplicity-and-performance-with-scott-hunter.aspx#comments</comments><description>
&lt;p&gt;On this episode of Pixel8 &lt;a href="http://blogs.msdn.com/scothu/" mce_href="http://blogs.msdn.com/scothu/"&gt;Scott Hunter&lt;/a&gt; (&lt;a href="http://twitter.com/coolcsh" mce_href="http://twitter.com/coolcsh"&gt;@coolsch&lt;/a&gt;) joins us to discuss his team’s focus on simplicity and performance in ASP.NET. Scott was kind enough to surprise me with some talking points about what his team is thinking about for releases coming &lt;b&gt;&lt;i&gt;after &lt;/i&gt;&lt;/b&gt;ASP.NET 4! Please note, what’s discussed herein are un-implemented features of ASP.NET so your feedback is not only welcome, but encouraged!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.infragistics.com/pixel8/media/p/207428.aspx"&gt;&lt;img src="http://download.infragistics.com/users/pixel8/images/pixel8podcast.png" border="0" height="118" width="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p style="margin-left: 60px;"&gt;&lt;a href="http://feeds.feedburner.com/Pixel8"&gt;Subscribe to the podcast!&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Velocity Provider for Caching:&lt;/b&gt; This will allow developers to plug in caching scenarios based on their needs.&lt;br&gt;&lt;br&gt; 
    &lt;/li&gt;

&lt;li&gt;&lt;b&gt;Automatic Generation of &lt;/b&gt;&lt;a href="http://www.alistapart.com/articles/sprites" mce_href="http://www.alistapart.com/articles/sprites"&gt;&lt;b&gt;CSS Sprites&lt;/b&gt;&lt;/a&gt;&lt;b&gt;:&lt;/b&gt; Adding images to the Content folder will trigger the ASP.NET framework to stitch together a single image which is later sliced up by inline styles. A helper method is responsible for generating markup of the appropriate CSS coordinates to wire-up the sprite. This feature will allow for groups so related images may be combined together. 
    &lt;br&gt;&lt;br&gt;&lt;/li&gt;

&lt;li&gt;&lt;b&gt;Complex Helpers:&lt;/b&gt; There are scores of common features and functionality that many developers want to include in their applications, but unfortunately right now these features require a lot of code to implement. In the future you may have helpers available that provide a simple API to do the following: 
    
&lt;ul&gt;
&lt;li&gt;Resize images &lt;/li&gt;

&lt;li&gt;Watermark images &lt;/li&gt;

&lt;li&gt;Flip images &lt;/li&gt;

&lt;li&gt;Send Email - helpers for single method calls to send and mail or verify an address [ex: Email.Send() or Email.VerifyAddress()] &lt;/li&gt;

&lt;li&gt;Schedule Tasks - submit tasks to a background worker process (wouldn’t take down app domain if exception occurred) &lt;/li&gt;

&lt;li&gt;Posting status updates to Facebook, Twitter, etc. &lt;/li&gt;

&lt;li&gt;Polls &lt;/li&gt;

&lt;li&gt;Ratings &lt;/li&gt;

&lt;li&gt;Comments &lt;/li&gt;

&lt;li&gt;OpenID integration &lt;/li&gt;
&lt;/ul&gt;
* Many of these features will likely be released outside the formal ASP.NET framework 
    &lt;br&gt;&lt;br&gt;&lt;/li&gt;

&lt;li&gt;&lt;b&gt;Data Simplicity:&lt;/b&gt; Active record implementation that features a code-first approach. Consider a blank database with no tables. The active record pattern would allow you to instantiate the &lt;b&gt;Foo&lt;/b&gt; class and then add values to &lt;b&gt;Foo.Bar1&lt;/b&gt; and &lt;b&gt;Foo.Bar2&lt;/b&gt;, then call &lt;b&gt;Foo.Save()&lt;/b&gt;. If the &lt;b&gt;Foo&lt;/b&gt; table does not exist in the database, then the table is created and the data is persisted. Also &lt;b&gt;Foo.All()&lt;/b&gt; would return all the records of &lt;b&gt;Foo&lt;/b&gt;, but the return type is an IQueryable so you could further filter on the server. The code-first won’t be the only direction the integration will work. Changes in the database can be reflected in the model by use of T4 templates. 
    &lt;br&gt;
    &lt;br&gt;&lt;b&gt;Note:&lt;/b&gt; I ask the requisite question about the virtues of the repository pattern as opposed to active record. Scott demonstrates how the implementation they are considering would not hinder you from exposing your own DTOs and wrapping a repository around the active record objects. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Also make sure you check out my post &lt;a href="http://weblogs.asp.net/craigshoemaker/archive/2009/12/04/12-ways-to-simplify-asp-net-and-visual-studio.aspx" mce_href="http://weblogs.asp.net/craigshoemaker/archive/2009/12/04/12-ways-to-simplify-asp-net-and-visual-studio.aspx"&gt;12 Ways to Simplify ASP.NET and Visual Studio&lt;/a&gt; I wrote after being inspired by this interview!&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7270703" width="1" height="1"&gt;</description><enclosure url="http://download.infragistics.com/pixel8/media/pixel8-2009-12-03-simplicity.mp3" length="36204443" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/visual+studio/default.aspx">visual studio</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Pixel8/default.aspx">Pixel8</category></item><item><title>12 Ways to Simplify ASP.NET and Visual Studio</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/12/04/12-ways-to-simplify-asp-net-and-visual-studio.aspx</link><pubDate>Fri, 04 Dec 2009 14:42:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7270602</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7270602</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/12/04/12-ways-to-simplify-asp-net-and-visual-studio.aspx#comments</comments><description>&lt;p&gt;While at PDC this year I had an opportunity to interview a number of smart and engaging people. One of my guests was &lt;a href="http://blogs.msdn.com/scothu/" mce_href="http://blogs.msdn.com/scothu/"&gt;Scott Hunter&lt;/a&gt; (&lt;a href="http://twitter.com/coolcsh" mce_href="http://twitter.com/coolcsh"&gt;@coolcsh&lt;/a&gt;) who these days is responsible for WebForms, ASP.NET Data and seemingly much more. To my surprise Scott wanted to talk about what is coming &lt;b&gt;&lt;i&gt;after&lt;/i&gt;&lt;/b&gt; ASP.NET 4! &lt;/p&gt;

&lt;p&gt;Taking a step back and looking at ASP.NET, tooling, data and the entire experience of working with the .NET stack Scott’s team and other groups in Microsoft are turning their attention to a single concept…&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Simplicity&lt;/p&gt;

&lt;p&gt;While I will refer you to the &lt;a href="http://getpixel8ed.com" mce_href="http://getpixel8ed.com"&gt;Pixel8&lt;/a&gt; podcast, &lt;a href="http://blogs.infragistics.com/pixel8/media/p/207428.aspx" mce_href="http://blogs.infragistics.com/pixel8/media/p/207428.aspx"&gt;ASP.NET Simplicity and Performance with Scott Hunter&lt;/a&gt;, to hear the details about ideas his team is entertaining to make ASP.NET easer and perform even faster, I thought I would throw in my two cents as well. The following is my wish list of twelve improvements to ASP.NET and Visual Studio that would undoubtedly make development faster and easier.&lt;/p&gt;

&lt;div style="margin-left: 20px;"&gt;
  &lt;h3&gt;1: Overload the DataBind Method &lt;/h3&gt;

  &lt;p&gt;How often have you worked with data bound control and wrote code like this:&lt;/p&gt;

  &lt;pre style="border: 1px solid rgb(204, 204, 204); padding: 4px; background-color: rgb(238, 238, 238); font-family: courier,sans-serif; font-size: 1.2em;"&gt;protected void Page_Load(object sender, EventArgs e)&lt;br&gt;{&lt;br&gt;  this.grid.DataSource = foo;&lt;br&gt;  this.grid.DataBind();&lt;br&gt;}&lt;/pre&gt;

  &lt;p&gt;Wouldn’t it be simpler if you could just call the DataBind method and pass in the data source?&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/databind.png" title="Overload the DataBind method" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/databind.png" height="150" width="629"&gt;&lt;/p&gt;

  &lt;p&gt;You can do this easily today by implementing an extension method as I did here, but it would be nice to have this as a first-class feature of the &lt;a href="http://weblogs.asp.net/controlpanel/blogs/BaseDataBoundControl" mce_href="BaseDataBoundControl"&gt;BaseDataBoundControl&lt;/a&gt; class.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;2: Implement IsFirstRequest Property&lt;/h3&gt;

  &lt;p&gt;The whole notion of the IsPostBack property always seemed a bit awkward to me. More often than not you are using this property to evaluate it’s negative state – in other words trying to figure out if the page is running under the context of the first request. I suggest the addition of a property that is no more than the reverse of IsPostBack:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/firstrequest.png" title="IsFirstRequest property" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/firstrequest.png" height="199" width="667"&gt;&lt;/p&gt;

  &lt;p&gt;It’s a small thing, but I think it makes code a little cleaner to read.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;3: Implement Application Name&lt;/h3&gt;

  &lt;p&gt;Often developers need a way to display the application name to users. While setting up a globally-scoped class to handle this task is trivial, but it would be nice if there was a “Name” property off the page’s locally scoped Application property:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/appname.png" title="Application Name" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/appname.png" height="90" width="456"&gt;&lt;/p&gt;

  &lt;p&gt;The value for this property would likely be saved in the web.config or Global.asax. Adding this feature may also help sort out a common &lt;a href="http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx"&gt;problem that arises in using the membership provider when developers forget to define an application name&lt;/a&gt;. Visual Studio could auto fill this value with the “application name” from the create project wizard and then allow an override at any time.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;4: Option to Categorize IntelliSense Members&lt;/h3&gt;

  &lt;p&gt;Ever wanted to tap into an event of an object, but weren’t sure what the event name was? Ever wanted to know just what an object methods were while trying to learn a new API? What about trying to find out if there is a property for &lt;b&gt;X&lt;/b&gt;? IntelliSense is an invaluable tool in it’s current form and Visual Studio 2010 adds some needed filtering behaviors for C#, but we can do even better.&lt;/p&gt;

  &lt;p&gt;It would be nice if IntelliSense had a way to display members in a categorical format:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/intellisense.png" title="IntelliSense categories" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/intellisense.png" height="262" width="491"&gt;&lt;/p&gt;

  &lt;p&gt;Obviously this isn’t a feature you would want enabled at all times, but it would make working with new APIs much easier.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;5: Bring XAML Data Binding Syntax to ASP.NET&lt;/h3&gt;

  &lt;p&gt;&lt;a href="http://weblogs.asp.net/davidfowler/" mce_href="http://weblogs.asp.net/davidfowler/"&gt;David Fowler&lt;/a&gt; (&lt;a href="http://twitter.com/davidfowl/" mce_href="http://twitter.com/davidfowl/"&gt;@davidfowl&lt;/a&gt;) has been churning out some amazing blog posts all around the topic of data binding in ASP.NET. One of his recent posts included an &lt;a href="http://weblogs.asp.net/davidfowler/archive/2009/11/13/databinding-3-0.aspx" mce_href="http://weblogs.asp.net/davidfowler/archive/2009/11/13/databinding-3-0.aspx"&gt;exposition of DataBinding 3.0&lt;/a&gt;. Basically the latest iteration of data binding brings the XAML syntax to ASP.NET data binding. &lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/bindingsyntax.png" title="XAML data binding syntax is ASP.NET" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/bindingsyntax.png"&gt;&lt;/p&gt;

  &lt;p&gt;This addition makes life easier because then you don’t have to worry about when you use the &lt;b&gt;Bind&lt;/b&gt; or &lt;b&gt;Eval&lt;/b&gt; syntax. Plus making a homogenous binding syntax among WPF, Silverlight, ASP.NET AJAX and ASP.NET WebForms makes working with the controls a natural task regardless of the platform you are working.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;6: Parameter Attributes&lt;/h3&gt;

  &lt;p&gt;When working with QueryString parameters requires some repetitious boilerplate code. Consider the following listing, which you have probably written thousands of times:&lt;/p&gt;

  &lt;pre style="border: 1px solid rgb(204, 204, 204); padding: 4px; background-color: rgb(238, 238, 238); font-family: courier,sans-serif; font-size: 1.2em;"&gt;private string UserName&lt;br&gt;{&lt;br&gt;  get&lt;br&gt;  {&lt;br&gt;    if(Request.QueryString["userName"] != null)&lt;br&gt;    {&lt;br&gt;      return Request.QueryString["userName"].ToString();&lt;br&gt;    }&lt;br&gt;    return string.Empty;&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;

  &lt;p&gt;How much simpler would it be if you could just &lt;a href="http://www.codeproject.com/KB/aspnet/QueryStringAttributes.aspx" mce_href="http://www.codeproject.com/KB/aspnet/QueryStringAttributes.aspx"&gt;decorate the property with an attribute and the retrieval code is implemented automatically&lt;/a&gt;?&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/parameters.png" title="Parameter Attributes" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/parameters.png" height="110" width="449"&gt;&lt;/p&gt;

  &lt;p&gt;This approach doesn’t have to stop with the query string either. The same types of attributes may be available for :&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;QueryString &lt;/li&gt;

    &lt;li&gt;Form Elements &lt;/li&gt;

    &lt;li&gt;Context Items &lt;/li&gt;

    &lt;li&gt;Session &lt;/li&gt;

    &lt;li&gt;Cache &lt;/li&gt;

    &lt;li&gt;Cookies &lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;7: WebForms Model Binders&lt;/h3&gt;

  &lt;p&gt;One of the features that I immediately fell in love with from the ASP.NET MVC framework was &lt;a href="http://www.singingeels.com/Articles/Model_Binders_in_ASPNET_MVC.aspx" mce_href="http://www.singingeels.com/Articles/Model_Binders_in_ASPNET_MVC.aspx"&gt;model binders&lt;/a&gt;. With the updates to ASP.NET 4 granting total control over the client IDs of server controls, now WebForms needs model binders!&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/modelbinder.png" title="ASP.NET Model Binders" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/modelbinder.png" height="310" width="642"&gt;&lt;/p&gt;

  &lt;p&gt;The pages could be strongly typed like MVC strongly typed views, or the designer could interrogate the control hierarchy and build the view model on the fly. Obviously we’d also need some hooks to tap into the flow to implement custom bindings too.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;8: JavaScript Model Binders&lt;/h3&gt;

  &lt;p&gt;Just as the server can benefit from automatic mapping of input controls to a model object, Ajax scenarios could be greatly simplified if there was a function to run on the client that automatically created a JSON object with all input values.&lt;/p&gt;

  &lt;p&gt;Consider a form like this:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/dto-ui.png" title="UI" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/dto-ui.png" height="103" width="564"&gt;&lt;/p&gt;

  &lt;p&gt;With markup like this:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/dto-markup.png" title="Markup" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/dto-markup.png" height="294" width="640"&gt;&lt;/p&gt;

  &lt;p&gt;A model, or DTO if you like, could easily be constructed by querying the form and building the object from input elements.&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/dto-js.png" title="JavaScript" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/dto-js.png" height="176" width="583"&gt;&lt;/p&gt;

  &lt;p&gt;There could even be special rules for certain controls like a select list. Sending the selected index, text and value as a group for the single control should provide all the information necessary to consuming resource.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;9: Select the Location of ViewState&lt;/h3&gt;

  &lt;p&gt;While ASP.NET 4 makes great strides to trim down a page’s ViewState it would still be nice to have explicit control over where the ViewState is rendered on the page. I’d love to see a server control that allows you to place the ViewState containers at a location of your choosing:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/viewstate.png" title="ViewSTate Container" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/viewstate.png" height="134" width="560"&gt;&lt;/p&gt;

  &lt;p&gt;Now more times than not the best approach is to simply &lt;a href="http://www.hanselman.com/blog/MovingViewStateToTheBottomOfThePage.aspx" mce_href="http://www.hanselman.com/blog/MovingViewStateToTheBottomOfThePage.aspx"&gt;move ViewState to the bottom of the page&lt;/a&gt;, but having explicit control of the placement seems like the best scenario.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;10: Disabling the Post Back Button&lt;/h3&gt;

  &lt;p&gt;The ASP.NET runtime will not recognize a post back initiated by a disabled button so developers have had to &lt;a href="http://aspalliance.com/829_Disabling_the_Postback_Button" mce_href="http://aspalliance.com/829_Disabling_the_Postback_Button"&gt;concoct some clever ways to protect users from themselves&lt;/a&gt;. It would be nice if ASP.NET had a way to reliably disable post back buttons out-of-the-box.&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/disabled.png" title="Disable PostBack Button" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/disabled.png" height="111" width="306"&gt;&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;11: Implement ASP.NET Configuration Console as Portable Area&lt;/h3&gt;

  &lt;p&gt;&lt;a href="http://www.lostechies.com/blogs/hex/" mce_href="http://www.lostechies.com/blogs/hex/"&gt;Eric Hexter&lt;/a&gt; (&lt;a href="http://twitter.com/ehexter" mce_href="http://twitter.com/ehexter"&gt;@ehexter&lt;/a&gt;) &lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx" mce_href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx"&gt;recently blogged about the concept of a “portable area”&lt;/a&gt; where you can compile single controls controls or even up to entire workflows into an assembly to later include in an ASP.NET MVC or &lt;a href="http://jeffreypalermo.com/blog/consuming-a-portable-area-with-a-web-forms-application/" mce_href="http://jeffreypalermo.com/blog/consuming-a-portable-area-with-a-web-forms-application/"&gt;WinForms application&lt;/a&gt;. This approach is perfect for implementing the ASP.NET configuration UI generated by Visual Studio.&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/admin.png" title="ASP.NET Configuration Console" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/admin.png" height="608" width="606"&gt; &lt;/p&gt;

  &lt;p&gt;The portable area approach would decouple the screens from the layout seen in this screenshot and allow the pages to reflect the layout of your website. This feature would be perfect for exposing the membership functionality to admins, power users or even just the development team.&lt;/p&gt;

  &lt;p&gt;&amp;nbsp;&lt;/p&gt;

  &lt;h3&gt;12: Script-Based Post Backs&lt;/h3&gt;

  &lt;p&gt;On occasion when working with WebForms under the traditional post back model you may need to implement a JavaScript function that initiates a post back. Right now, the approach for executing this a hack at best. One the best ways I have seen to accomplish this is to add a LinkButton to the page and hide it from the user using CSS. Then you can view source on the page and use the __doPostBack call the LinkButton was using in your custom script – like I said &lt;i&gt;real&lt;/i&gt; hacky :)&lt;/p&gt;

  &lt;p&gt;It would make life much simpler for the times when this functionality is required to have a method off the Sys namespace (or wherever appropriate) that posts back a WebForm. This is how it could look:&lt;/p&gt;

  &lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/simplicity/scriptpost.png" title="Script-based post backs" mce_src="http://polymorphicpodcast.com/images/blog/simplicity/scriptpost.png" height="244" width="491"&gt;&lt;/p&gt;

  &lt;p&gt;Passing a string into the function would tell the page which handler to map to in the page event lifecycle.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;So there you have it. These are some of my ideas about how to make ASP.NET and Visual Studio simpler to use. Now tell me, what are yours?&lt;/p&gt;
&lt;b&gt;&lt;/b&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7270602" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/visual+studio/default.aspx">visual studio</category></item><item><title>Integrating Infragistics Drag &amp; Drop with jQuery and Microsoft Ajax Preview 6</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx</link><pubDate>Tue, 10 Nov 2009 21:15:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7250872</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7250872</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx#comments</comments><description>&lt;h2&gt;The Concept&lt;/h2&gt;

&lt;p&gt;I created “&lt;a href="http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx" mce_href="http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx"&gt;Ugly Outfitters&lt;/a&gt;” to showcase the interaction between &lt;a href="http://www.infragistics.com/dotnet/netadvantage/aspnet/dragdrop.aspx#Overview" mce_href="http://www.infragistics.com/dotnet/netadvantage/aspnet/dragdrop.aspx#Overview"&gt;Infragistics Drag &amp;amp; Drop&lt;/a&gt;, &lt;a href="http://jquery.com/" mce_href="http://jquery.com/"&gt;jQuery&lt;/a&gt; and &lt;a href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;amp;referringTitle=Home" mce_href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;amp;referringTitle=Home"&gt;Microsoft Ajax Preview 6&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Why Ugly Outfitters? Well, I decided that rather than just dragging around some bland icons on the screen why not attempt to inject a little bit of humor into the process. Like I said... attempt ;)&lt;/p&gt;

&lt;p&gt;If you want to jump right in take a look at this short video demonstrating the application with a quick overview of the code:&lt;/p&gt;

&lt;p&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/LUTAwKFybsc&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/LUTAwKFybsc&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" mce_src="http://www.youtube.com/v/LUTAwKFybsc&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/object&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Also available are &lt;a href="http://community.infragistics.com/aspnet/media/p/186691.aspx" mce_href="http://community.infragistics.com/aspnet/media/p/186691.aspx"&gt;higher quality versions of the video.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What follows is an excerpt of the discussion of what’s found in Ugly Outfitters. The best way to get acquainted with the details is always to &lt;a href="http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx#_download" mce_href="http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx#_download"&gt;download the code&lt;/a&gt; and review it’s design.&lt;/p&gt;

&lt;h2&gt;The Approach&lt;/h2&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/images/craigs/blog/2009-11-06/uo.gif" mce_src="http://media.infragistics.com/community/images/craigs/blog/2009-11-06/uo.gif" align="right" hspace="10" vspace="10"&gt;&lt;/p&gt;

&lt;p&gt;The page is constructed to have a list of shirts on the top of the page, a list of pants along the bottom and a large “outfit designer” area to preview combinations. Along with the coupling of the garment images, when an image is dropped on the page the garment title and description are updated.&lt;/p&gt;

&lt;p&gt;A typical approach of constructing a page like this is often to include a server-side repeater to generate the HTML required to list the shirt and pant images. Instead of explicitly rendering HTML for each list item, this page uses a series of client templates to create the thumb nail lists. The data for the page is served to the client in JSON arrays, rather than being embedded into blocks of HTML. Using the JSON arrays make coding interaction on the page easy as all the required data is available in a programmatically accessible format.&lt;/p&gt;

&lt;h3&gt;Variations&lt;/h3&gt;

&lt;p&gt;The sample is available in three different variations. The first sample uses the ASP.NET ScriptManager control to bring in the required scripts and leverages the code behind to render the JSON array to the page. &lt;/p&gt;

&lt;p&gt;The second sample is exactly the same as the first except instead of using a ScriptManager, the JavaScript files are loaded into the page using the Microsoft Ajax Preview 6 Script Loader control. The Script Loader is used to bring in ASP.NET AJAX, the Client Templates, jQuery and the Infragistics Drag and Drop Framework.&lt;/p&gt;

&lt;p&gt;The final variation extends the second sample, but removes the dependence on the code behind and is a static HTML file. Data is injected into the page by referencing a dynamic JavaScript file. This script file is added as a custom script and then loaded into the page using the Script Loader.&lt;/p&gt;

&lt;p&gt;To read the full write-up including code samples, please check out: &lt;a href="http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx#_jumpStart" mce_href="http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2009/11/10/integrating-infragistics-drag-amp-drop-with-jquery-and-microsoft-ajax-preview-6.aspx#_jumpStart"&gt;Integrating Infragistics Drag &amp;amp; Drop with jQuery and Microsoft Ajax Preview 6&lt;/a&gt; on my Infragistics blog.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7250872" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/NetAdvantage/default.aspx">NetAdvantage</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Infragistics/default.aspx">Infragistics</category></item><item><title>VM Workshop: Model View ViewModel (MVVM) and the Presentation Model Pattern in 5 UI Platforms</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/11/03/vm-workshop-model-view-viewmodel-mvvm-and-the-presentation-model-pattern-in-5-ui-platforms.aspx</link><pubDate>Tue, 03 Nov 2009 16:51:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7245973</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7245973</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/11/03/vm-workshop-model-view-viewmodel-mvvm-and-the-presentation-model-pattern-in-5-ui-platforms.aspx#comments</comments><description>
&lt;p&gt;For some reason the family of design patterns that exist around the &lt;a href="http://en.wikipedia.org/wiki/Model-view-controller" mce_href="http://en.wikipedia.org/wiki/Model-view-controller"&gt;Model View Controller&lt;/a&gt; pattern seem to be an elusive band of characters. The first time I&amp;nbsp; encountered Model View Controller I studied the text hard trying to understand how the &lt;a href="http://en.wikipedia.org/wiki/Strategy_pattern" mce_href="http://en.wikipedia.org/wiki/Strategy_pattern"&gt;Strategy&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Observer_pattern" mce_href="http://en.wikipedia.org/wiki/Observer_pattern"&gt;Observer&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Composite_pattern" mce_href="http://en.wikipedia.org/wiki/Composite_pattern"&gt;Composite&lt;/a&gt; patterns worked together to accomplish some goal that – try as I might - remained fuzzy. Somehow I have a sense that I am not alone.&lt;/p&gt;

&lt;p&gt;Model View Controller (MVC) is the parent pattern to a number of contemporary patterns that seem to find a natural home in Microsoft development. Variations of MVC have appeared over the years in an attempt to work within the construct of modern event-driven programming models. One of most distinguishing differences among MVC and some of the derivative patterns is that with MVC the controller executes first, where with the other patterns the view tends to execute first and then delegates control to some sort of “presentation” class.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/vmworkshop/patterns.gif" alt="VM Workshop Patterns" mce_src="http://polymorphicpodcast.com/vmworkshop/patterns.gif" height="382" width="550"&gt;&lt;/p&gt;

&lt;p&gt;A few years ago I did a series on Model View Presenter (MVP) [&lt;a href="http://polymorphicpodcast.com/shows/mv-patterns/" mce_href="http://polymorphicpodcast.com/shows/mv-patterns/"&gt;Design Patterns Bootcamp: Model View * Patterns&lt;/a&gt;] in an attempt to discuss how to completely abstract away the user interface layer. MVP proves to be an effective pattern, but can be confusing to some with the heavy use of interfaces and events.&lt;/p&gt;

&lt;p&gt;The recent popularity of XAML applications has brought focus to the &lt;a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" mce_href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx"&gt;Model View ViewModel&lt;/a&gt; (MVVM) pattern, which is technically a fine-tuned version of &lt;a href="http://martinfowler.com/eaaDev/PresentationModel.html" mce_href="http://martinfowler.com/eaaDev/PresentationModel.html"&gt;Presentation Model&lt;/a&gt; that &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/11/479632.aspx" mce_href="http://blogs.msdn.com/johngossman/archive/2005/10/11/479632.aspx"&gt;takes advantage of .NET’s data binding framework&lt;/a&gt;. Further, the advent of ASP.NET MVC has created a strong push for some sort of presentation strategy into the realm of ASP.NET WebForms.&lt;/p&gt;

&lt;p&gt;So this history lesson is great, but how do you do you write the code to implement the patterns?&lt;/p&gt;

&lt;h2&gt;Introducing VM Workshop&lt;/h2&gt;

&lt;p&gt;The &lt;a href="http://polymorphicpodcast.com/vmworkshop" mce_href="http://polymorphicpodcast.com/vmworkshop"&gt;VM Workshop&lt;/a&gt; is a simple reference application demonstrating the Model View ViewModel and Presentation Model pattern in a number of different UI platforms.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://polymorphicpodcast.com/vmworkshop/" mce_href="http://polymorphicpodcast.com/vmworkshop/"&gt;&lt;img src="http://polymorphicpodcast.com/vmworkshop/logo.png" mce_src="http://polymorphicpodcast.com/vmworkshop/logo.png" align="right" border="0" height="227" hspace="15" vspace="15" width="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project includes examples in:&lt;/p&gt;

&lt;ul&gt;
  
&lt;li&gt;Silverlight &lt;/li&gt;

  
&lt;li&gt;WPF &lt;/li&gt;

  
&lt;li&gt;WebForms &lt;/li&gt;

  
&lt;li&gt;ASP.NET MVC &lt;/li&gt;

  
&lt;li&gt;Ajax &lt;/li&gt;

  
&lt;li&gt;WinForms &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…and as an &lt;a href="http://vmworkshop.codeplex.com/" mce_href="http://vmworkshop.codeplex.com/"&gt;open source project&lt;/a&gt;, you are invited to help add examples of how to deal with a myriad of different UI use cases!&lt;/p&gt;

&lt;p&gt;The purpose of the VM Workshop is to be a working programmer’s reference, not an exposition in pattern purity. Therefore you may see small details that may not fit the textbook definition of the patterns, but the point is to provide a template for effective pattern use. For instance there is an example in ASP.NET MVC is included in VM Workshop. Obviously the pattern being implemented is Model View Controller, but the construction of a “view model” class is still relevant in this context. While referring to ViewModel class in a ASP.NET application may be technically inappropriate, I use the term “view model” to interchangeably refer to a ViewModel or Presentation Model class for simplicity. &lt;/p&gt;

&lt;p&gt;I recently messaged &lt;a href="http://blogs.msdn.com/johngossman/" mce_href="http://blogs.msdn.com/johngossman/"&gt;John Gossman&lt;/a&gt;, arguably one of the most visible proponent of MVVM, to ask whether or not MVVM is exclusive to XMAL applications or if the pattern may be applied to any UI platform. John replied saying:&lt;/p&gt;

&lt;blockquote&gt;
 
&lt;p&gt;&lt;i&gt;I think the pattern is completely applicable to any UI technology.&amp;nbsp; There are some details around the use of commands and data-binding that tend to be XAML specific, so I tend to use MVVM for the XAML version of the pattern and to keep from having religious wars with Patterns zealots.&amp;nbsp; The more general pattern is called PresentationModel by Fowler.&amp;nbsp; OTOH, one of the nice things is if you design your Model and ViewModel’s correctly you should be able to reuse them between XAML-based and other UI technologies.&lt;/i&gt; &lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;VM Workshop is meant to be a learn-by-example project showcasing different styles of implementation.&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;Examples in C# and VB.NET&lt;/h3&gt;

&lt;p&gt;Often discussions surrounding design patterns tend to only be available in C#. In order to extend the conversation to as many developers as possible, I’ve include a VB.NET solution that operates in complete parity to the C# version. The only difference in the VB.NET version is that due to lack of lambda support some of the places &lt;a href="http://www.codeplex.com/AutoMapper" mce_href="http://www.codeplex.com/AutoMapper"&gt;AutoMapper&lt;/a&gt; is leveraged in the C# version are removed and objects are mapped manually. &lt;/p&gt;

&lt;h2&gt;A Grid, a Form and an Action&lt;/h2&gt;

&lt;p&gt;The initial example is provided for all the UI platforms. Each implementation features the same UI and workflow composition. First a grid is presented to the user:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/vmworkshop/grid.png" alt="Grid" mce_src="http://polymorphicpodcast.com/vmworkshop/grid.png" height="278" width="234"&gt;&lt;/p&gt;

&lt;p&gt;Upon selecting an individual item, an edit form becomes available allowing the user make changes to the item:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/vmworkshop/form.png" alt="Form" mce_src="http://polymorphicpodcast.com/vmworkshop/form.png" height="257" width="372"&gt;&lt;/p&gt;

&lt;blockquote&gt;
  
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; These screen shots here are taken from the WebForms sample, but the UI reflects the appropriate look for each of the respective UI technologies.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;Once changes are complete, and the ‘Save' button is pressed, the persistence operation is initiated. After persistence is complete, each implementation tells the UI to how to response respond to the action.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Please note that true persistence is not implemented in VM Workshop.&lt;/b&gt; In an effort to avoid using a database (which keeps the code more portable) persistence functions are simply stubbed out in the code. In the end, the project includes the same messages that would be sent among the application layers in any real-world application. &lt;/p&gt;

&lt;h2&gt;Minimizing Code in the View&lt;/h2&gt;

&lt;p&gt;The motivation for using these patterns is often creating a more testable user interface layer, decoupling your application from UI technologies or perhaps to promote better application composition. No matter what the motivation, the overarching goal is to remove application logic from the view layer. The examples in VM Workshop use a number of general concepts to achieve a thin view. &lt;/p&gt;

&lt;h3&gt;Lazy Loading&lt;/h3&gt;

&lt;p&gt;The grids are populated through a lazy loaded property on the view model class. This ensures that the request for data is restricted to only the times when the data wasn’t previously prepared. Another benefit is that a call to somehow ‘get stuff’ is not required. When the grid binds to the 'Products' property the property’s implementation knows where to get the data if it doesn’t have it.&lt;/p&gt;

&lt;h3&gt;Visibility Properties&lt;/h3&gt;

&lt;p&gt;Visibility properties (in XAML implementations) or boolean properties on the view model classes are used to control whether or not controls, messages or other UI elements appear to the user. Binding the state of these properties to the appropriate elements on the screen relieves the view of having to decide what is shown to the user and what is hidden.&lt;/p&gt;

&lt;h3&gt;No Logical Operations&lt;/h3&gt;

&lt;p&gt;While taking great care to remove all logical operations from the view, even seemingly benign tasks such as casting input into primitive types is delegated to the view model or some other class for execution. Even simple operations like type casting can quickly cascade into a series of business rules. Consider how convoluted validation scenarios can become when the application is expecting a currency value, but is one way or another served a string. While the validation does have UI implications, this type of logic is best handled in a lower level than the view.&lt;/p&gt;

&lt;h3&gt;Presentation Objects and Data Transfer Objects&lt;/h3&gt;

&lt;p&gt;The use of presentation objects or data transfer objects, or DTOs, (I tend to flip between terms depending on my mood) is used to accomplish at least two goals:&lt;/p&gt;

&lt;ol&gt;
  
&lt;li&gt;&lt;b&gt;Hide the domain model from the rest of the application.&lt;/b&gt; Concealing the full-fledged Products class from the view makes sure unnecessary pressure is not exerted on the model to mutate at the whim of the view. 
    &lt;br&gt;&lt;br&gt;&lt;/li&gt;

  
&lt;li&gt;&lt;b&gt;Make custom mapping the responsibility of the type.&lt;/b&gt; The presentation object’s job is to prepare the data coming from the domain model into a form that is natural to the view. This mapping or conversion responsibility is best placed in the hands of the presentation object and not within the procedure of an operation. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Get Acquainted&lt;/h2&gt;

&lt;p&gt;Check out the video that will get you oriented with VM Workshop:&lt;/p&gt;

&lt;p&gt;
&lt;object height="344" width="425"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/zXIzIzbO7pM&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;
&lt;param name="allowFullScreen" value="true"&gt;
&lt;param name="allowscriptaccess" value="always"&gt;
&lt;embed src="http://www.youtube.com/v/zXIzIzbO7pM&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" mce_src="http://www.youtube.com/v/zXIzIzbO7pM&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/object&gt;
&lt;/p&gt;

&lt;h2&gt;Get Involved&lt;/h2&gt;

&lt;p&gt;The code for &lt;a href="http://vmworkshop.codeplex.com" mce_href="http://vmworkshop.codeplex.com"&gt;VM Workshop is available on CodePlex&lt;/a&gt; and you are encouraged to submit your implementations into the workshop!&lt;/p&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;p&gt;VM Workshop uses &lt;a href="http://nbuilder.org/" mce_href="http://nbuilder.org/"&gt;nBuilder&lt;/a&gt; create data objects and &lt;a href="http://www.codeplex.com/AutoMapper" mce_href="http://www.codeplex.com/AutoMapper"&gt;AutoMapper&lt;/a&gt; for DTO to domain object mapping.&lt;/p&gt;

&lt;h2&gt;Thanks&lt;/h2&gt;

&lt;p&gt;Thanks to &lt;a href="http://infragistics.com/" mce_href="http://infragistics.com/"&gt;Infragistics&lt;/a&gt; for providing the time to develop the VM Workshop.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7245973" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/WPF/default.aspx">WPF</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/windows+forms/default.aspx">windows forms</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/MVVM/default.aspx">MVVM</category></item><item><title>ASP.NET AJAX Preview 6 with Stephen Walther </title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/11/02/asp-net-ajax-preview-6-with-stephen-walther.aspx</link><pubDate>Mon, 02 Nov 2009 23:12:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7245521</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7245521</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/11/02/asp-net-ajax-preview-6-with-stephen-walther.aspx#comments</comments><description>
&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/"&gt;Stephen Walther&lt;/a&gt;, Microsoft Product Manager for &lt;a href="http://asp.net/ajax"&gt;ASP.NET AJAX&lt;/a&gt;, joins the show to discuss the recent advancements in the AJAX toolset found in Preview 6. Listen or download below!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://polymorphicpodcast.com/shows/ajaxpreview6/" mce_href="http://polymorphicpodcast.com/shows/ajaxpreview6/"&gt;&lt;img src="http://polymorphicpodcast.com/images/ListenBanner.png" title="Listen to the Show" alt="Listen to the Show" mce_src="http://polymorphicpodcast.com/images/ListenBanner.png" border="0" height="58" width="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;table border="0" cellpadding="3" cellspacing="3"&gt;&lt;tbody&gt;
    
&lt;tr&gt;
      &lt;th align="left"&gt;Full Speed:&lt;/th&gt;
      
&lt;td&gt;&lt;a href="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-10-26-ajaxpreview6.mp3"&gt;download&lt;/a&gt;&lt;/td&gt;

      
&lt;td&gt;
&lt;object type="application/x-shockwave-flash" data="http://polymorphicpodcast.com/plugins/audio-player/player.swf" id="audioplayer1" height="24" width="290"&gt;     
&lt;param name="movie" value="http://polymorphicpodcast.com/plugins/audio-player/player.swf"&gt;     
&lt;param name="FlashVars" value="playerID=1&amp;amp;bg=0xE9E6DF&amp;amp;leftbg=0xEEEEEE&amp;amp;lefticon=0x666666&amp;amp;rightbg=0xCCCCCC&amp;amp;rightbghover=0x999999&amp;amp;righticon=0x666666&amp;amp;righticonhover=0xFFFFFF&amp;amp;text=0x666666&amp;amp;slider=0x666666&amp;amp;track=0xFFFFFF&amp;amp;border=0x666666&amp;amp;loader=0xCCCCCC&amp;amp;soundFile=http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-10-26-ajaxpreview6.mp3"&gt;     
&lt;param name="quality" value="high"&gt;     
&lt;param name="wmode" value="transparent"&gt;     &lt;/object&gt;
&lt;/td&gt;
    &lt;/tr&gt;

    
&lt;tr&gt;
      &lt;th align="left"&gt;Fast Version:&lt;/th&gt;
      
&lt;td&gt;&lt;a href="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-10-26-ajaxpreview6_fast.mp3"&gt;download&lt;/a&gt;&lt;/td&gt;

      
&lt;td&gt;
&lt;object type="application/x-shockwave-flash" data="http://polymorphicpodcast.com/plugins/audio-player/player.swf" id="audioplayer1" height="24" width="290"&gt;     
&lt;param name="movie" value="http://polymorphicpodcast.com/plugins/audio-player/player.swf"&gt;     
&lt;param name="FlashVars" value="playerID=1&amp;amp;bg=0xE9E6DF&amp;amp;leftbg=0xEEEEEE&amp;amp;lefticon=0x666666&amp;amp;rightbg=0xCCCCCC&amp;amp;rightbghover=0x999999&amp;amp;righticon=0x666666&amp;amp;righticonhover=0xFFFFFF&amp;amp;text=0x666666&amp;amp;slider=0x666666&amp;amp;track=0xFFFFFF&amp;amp;border=0x666666&amp;amp;loader=0xCCCCCC&amp;amp;soundFile=http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-10-26-ajaxpreview6_fast.mp3"&gt;     
&lt;param name="quality" value="high"&gt;     
&lt;param name="wmode" value="transparent"&gt;     &lt;/object&gt;
&lt;/td&gt;

    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;Just about all the details discussed in our conversation are available from the following links:&lt;/p&gt;

&lt;ul&gt;
  
&lt;li&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2009/10/15/announcing-microsoft-ajax-library-preview-6-and-the-microsoft-ajax-minifier.aspx"&gt;Announcing Microsoft Ajax Library (Preview 6) and the Microsoft Ajax Minifier&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://weblogs.asp.net/bleroy/archive/2009/10/15/entirely-unobtrusive-and-imperative-templates-with-microsoft-ajax-4-preview-6.aspx"&gt;Entirely unobtrusive and imperative templates with Microsoft Ajax Library Preview 6&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34488"&gt;CodePlex Site&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://jtemplates.tpython.com/"&gt;jTemplates&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;A Changed Landscape: ASP.NET AJAX&lt;/h3&gt;

&lt;p&gt;If you are in the Southern California area and would like to see some of the latest AJAX bits in action I am giving my talk to the following user groups: &lt;/p&gt;

&lt;ul&gt;
  
&lt;li&gt;&lt;a href="http://www.iedotnetug.org/UG/"&gt;Inland Empire .NET User Group&lt;/a&gt; 12/8/09 &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://www.ocdotnet.org/"&gt;Orange County .NET User Group&lt;/a&gt; 1/12/10 &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://www.ladotnet.org/default.asp"&gt;LA.NET User Group&lt;/a&gt; 2/1/10 &lt;/li&gt;

&lt;/ul&gt;

&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7245521" width="1" height="1"&gt;</description><enclosure url="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-10-26-ajaxpreview6.mp3" length="37611422" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Polymorphic+Podcast/default.aspx">Polymorphic Podcast</category></item><item><title>jQuery Secrets with Dave Ward</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/06/22/jquery-secrets-with-dave-ward.aspx</link><pubDate>Mon, 22 Jun 2009 13:53:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7131982</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7131982</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/06/22/jquery-secrets-with-dave-ward.aspx#comments</comments><description>
&lt;p&gt;&lt;a href="http://encosia.com/" mce_href="http://encosia.com/"&gt;Dave Ward&lt;/a&gt; specializes in writing about ASP.NET, jQuery and ASP.NET AJAX. He is a contributing author to ASP.NET Ajax in Action, Second Edition from Manning, &lt;a href="http://nerddinner.com/" mce_href="http://nerddinner.com/"&gt;Nerd Dinner&lt;/a&gt;’s JavaScript secret weapon, listed on the &lt;a href="http://programming.alltop.com/" mce_href="http://programming.alltop.com/"&gt;Programming homepage of Alltop&lt;/a&gt; and newly inducted &lt;a href="http://aspinsiders.com/" mce_href="http://aspinsiders.com/"&gt;ASP Insider&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://polymorphicpodcast.com/shows/jquery/" mce_href="http://polymorphicpodcast.com/shows/jquery/"&gt;&lt;img src="http://polymorphicpodcast.com/images/ListenBanner.png" title="Listen to the Show" alt="Listen to the Show" mce_src="http://polymorphicpodcast.com/images/ListenBanner.png" border="0" width="378" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;table border="0" cellpadding="3" cellspacing="3"&gt;&lt;tbody&gt;
    
&lt;tr&gt;
      &lt;th align="left"&gt;Full Speed:&lt;/th&gt;
      
&lt;td&gt;&lt;a href="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery.mp3" mce_href="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery.mp3"&gt;download&lt;/a&gt;&lt;/td&gt;

      
&lt;td&gt;
&lt;object type="application/x-shockwave-flash" data="http://polymorphicpodcast.com/plugins/audio-player/player.swf" id="audioplayer1" width="290" height="24"&gt;     
&lt;param name="movie" value="http://polymorphicpodcast.com/plugins/audio-player/player.swf"&gt;     
&lt;param name="FlashVars" value="playerID=1&amp;amp;bg=0xE9E6DF&amp;amp;leftbg=0xEEEEEE&amp;amp;lefticon=0x666666&amp;amp;rightbg=0xCCCCCC&amp;amp;rightbghover=0x999999&amp;amp;righticon=0x666666&amp;amp;righticonhover=0xFFFFFF&amp;amp;text=0x666666&amp;amp;slider=0x666666&amp;amp;track=0xFFFFFF&amp;amp;border=0x666666&amp;amp;loader=0xCCCCCC&amp;amp;soundFile=http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery.mp3"&gt;     
&lt;param name="quality" value="high"&gt;     
&lt;param name="wmode" value="transparent"&gt;     &lt;/object&gt;
&lt;/td&gt;
    &lt;/tr&gt;

    
&lt;tr&gt;
      &lt;th align="left"&gt;Fast Version:&lt;/th&gt;
      
&lt;td&gt;&lt;a href="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery_fast.mp3" mce_href="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery_fast.mp3"&gt;download&lt;/a&gt;&lt;/td&gt;

      
&lt;td&gt;
&lt;object type="application/x-shockwave-flash" data="http://polymorphicpodcast.com/plugins/audio-player/player.swf" id="audioplayer1" width="290" height="24"&gt;     
&lt;param name="movie" value="http://polymorphicpodcast.com/plugins/audio-player/player.swf"&gt;     
&lt;param name="FlashVars" value="playerID=1&amp;amp;bg=0xE9E6DF&amp;amp;leftbg=0xEEEEEE&amp;amp;lefticon=0x666666&amp;amp;rightbg=0xCCCCCC&amp;amp;rightbghover=0x999999&amp;amp;righticon=0x666666&amp;amp;righticonhover=0xFFFFFF&amp;amp;text=0x666666&amp;amp;slider=0x666666&amp;amp;track=0xFFFFFF&amp;amp;border=0x666666&amp;amp;loader=0xCCCCCC&amp;amp;soundFile=http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery_fast.mp3"&gt;     
&lt;param name="quality" value="high"&gt;     
&lt;param name="wmode" value="transparent"&gt;     &lt;/object&gt;
&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p style="margin: 5px; padding: 5px; background-color: rgb(238, 238, 238);"&gt;&lt;b&gt;Note:&lt;/b&gt; Be sure to check out the &lt;a href="http://feeds2.feedburner.com/PolymorphicPodcastFastFeed" mce_href="http://feeds2.feedburner.com/PolymorphicPodcastFastFeed"&gt;Fast Feed&lt;/a&gt; if your are looking for the same content in 3/4ths the time!&lt;/p&gt;

&lt;h2&gt;What is jQuery?&lt;/h2&gt;

&lt;p&gt;The &lt;a href="http://jquery.com/" mce_href="http://jquery.com/"&gt;jQuery&lt;/a&gt; movement is seemingly everywhere, but if you still remain curious what jQuery is, &lt;a href="http://www.west-wind.com/weblog/" mce_href="http://www.west-wind.com/weblog/"&gt;Rick Strahl&lt;/a&gt; has an excellent introduction to library here: &lt;a href="http://www.west-wind.com/presentations/jquery/" mce_href="http://www.west-wind.com/presentations/jquery/"&gt;An Introduction to jQuery&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Jquery" mce_href="http://en.wikipedia.org/wiki/Jquery"&gt;jQuery Wikipedia page&lt;/a&gt; tells us that jQuery contains the following features:&lt;/p&gt;

&lt;blockquote style="font-style: italic;"&gt;
  
&lt;ul&gt;
    
&lt;li&gt;DOM element selections using the cross-browser open source selector engine Sizzle, a spin-off out of jQuery project &lt;/li&gt;

    
&lt;li&gt;DOM traversal and modification (including support for CSS 1-3 and basic XPath) &lt;/li&gt;

    
&lt;li&gt;Events &lt;/li&gt;

    
&lt;li&gt;CSS manipulation &lt;/li&gt;

    
&lt;li&gt;Effects and animations &lt;/li&gt;

    
&lt;li&gt;Ajax &lt;/li&gt;

    
&lt;li&gt;Extensibility &lt;/li&gt;

    
&lt;li&gt;Utilities - such as browser version and the each function. &lt;/li&gt;

    
&lt;li&gt;JavaScript Plugins &lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Dave’s jQuery Tips for Web Developers&lt;/h2&gt;

&lt;ul&gt;
  
&lt;li&gt;&lt;strong&gt;Learn the selectors -they are crucial! &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;&lt;a href="http://docs.jquery.com/Selectors/even" mce_href="http://docs.jquery.com/Selectors/even"&gt;:even&lt;/a&gt; and &lt;a href="http://docs.jquery.com/Selectors/odd" mce_href="http://docs.jquery.com/Selectors/odd"&gt;:odd&lt;/a&gt; – &lt;a href="http://15daysofjquery.com/examples/zebra/" mce_href="http://15daysofjquery.com/examples/zebra/"&gt;zebra striping is the classic example&lt;/a&gt; &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://docs.jquery.com/Selectors/not" mce_href="http://docs.jquery.com/Selectors/not"&gt;:not&lt;/a&gt; – Powerful when using classes as flags. &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://docs.jquery.com/Selectors/text" mce_href="http://docs.jquery.com/Selectors/text"&gt;:text&lt;/a&gt; – Often overlooked. Easier/cleaner than ‘input[type=text]’. &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://docs.jquery.com/Selectors/attributeEndsWith#attributevalue" mce_href="http://docs.jquery.com/Selectors/attributeEndsWith#attributevalue"&gt;attribute$=ID&lt;/a&gt; – One way to overcome the ClientID issue.&amp;nbsp; (&lt;a href="http://encosia.com/2009/06/09/11-keystrokes-that-made-my-jquery-selector-run-10x-faster/" mce_href="http://encosia.com/2009/06/09/11-keystrokes-that-made-my-jquery-selector-run-10x-faster/"&gt;Be careful about performance&lt;/a&gt;) 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Leverage &lt;/strong&gt;&lt;a href="http://www.mikeborozdin.com/post/CSS-Class-Names-Instead-of-ASPNET-Client-IDs.aspx" mce_href="http://www.mikeborozdin.com/post/CSS-Class-Names-Instead-of-ASPNET-Client-IDs.aspx"&gt;&lt;strong&gt;CSS classes instead of element IDs&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;Avoids the ClientID issue &lt;/li&gt;

      
&lt;li&gt;Good for selecting groups, like GridView rows. 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Look for plugins before reinventing the wheel &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;&lt;a href="http://jqueryui.com/" mce_href="http://jqueryui.com/"&gt;jQueryUI&lt;/a&gt; covers the basics &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://plugins.jQuery.com" mce_href="http://plugins.jQuery.com"&gt;plugins.jQuery.com&lt;/a&gt; for more 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Conversely, be sure you need a plugin &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;Classic example is using an &lt;a href="http://plugins.jquery.com/project/accordion" mce_href="http://plugins.jquery.com/project/accordion"&gt;accordion&lt;/a&gt; when &lt;a href="http://docs.jquery.com/Effects/slideToggle" mce_href="http://docs.jquery.com/Effects/slideToggle"&gt;slideToggle&lt;/a&gt; is all you really needed. &lt;/li&gt;

      
&lt;li&gt;Similarly, a lot of people don’t realize they can use &lt;a href="http://docs.jquery.com/Utilities/jQuery.each" mce_href="http://docs.jquery.com/Utilities/jQuery.each"&gt;$.each()&lt;/a&gt; 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Don’t be afraid to use fake CSS classes as “flags” &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;Blackjack game example: .card.flipped and .card:not(.flipped) 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Write Unobtrusive JavaScript &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;ASP.NET conditioned us to think &lt;a href="http://www.w3schools.com/aspnet/prop_webcontrol_button_onclientclick.asp" mce_href="http://www.w3schools.com/aspnet/prop_webcontrol_button_onclientclick.asp"&gt;OnClientClient&lt;/a&gt; and &lt;a href="http://www.4guysfromrolla.com/articles/021104-1.aspx" mce_href="http://www.4guysfromrolla.com/articles/021104-1.aspx"&gt;Attributes.Add&lt;/a&gt; is proper, but wiring up &lt;a href="http://docs.jquery.com/Events/bind" mce_href="http://docs.jquery.com/Events/bind"&gt;unobtrusive event handlers is much cleaner and more maintainable&lt;/a&gt; 
        
&lt;ul&gt;
          
&lt;li&gt;$(‘#element’).click() is the same as $addHandler($get(‘element’), ‘click’) in ASP.NET AJAX &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://www.ejball.com/EdAtWork/2005/03/28/JavaScriptAnonymousFunctions.aspx" mce_href="http://www.ejball.com/EdAtWork/2005/03/28/JavaScriptAnonymousFunctions.aspx"&gt;Anonymous functions&lt;/a&gt; are the norm in most jQuery code examples.&amp;nbsp; Nothing to be scared of.&amp;nbsp; More syntactical sugar than anything 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Use &lt;/strong&gt;&lt;a href="http://getfirebug.com/" mce_href="http://getfirebug.com/"&gt;&lt;strong&gt;Firebug&lt;/strong&gt;&lt;/a&gt; 
    
&lt;ul&gt;
      
&lt;li&gt;The &lt;a href="http://getfirebug.com/logging.html" mce_href="http://getfirebug.com/logging.html"&gt;inspect&lt;/a&gt; and &lt;a href="http://getfirebug.com/console.html" mce_href="http://getfirebug.com/console.html"&gt;console&lt;/a&gt; help you learn faster &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://blogs.msdn.com/ie/archive/2008/03/07/improved-productivity-through-internet-explorer-8-developer-tools.aspx" mce_href="http://blogs.msdn.com/ie/archive/2008/03/07/improved-productivity-through-internet-explorer-8-developer-tools.aspx"&gt;IE8’s developer toolbar&lt;/a&gt; works pretty well too 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Take advantage Bookmarklets &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;&lt;a href="http://www.learningjquery.com/2006/12/jquerify-bookmarklet" mce_href="http://www.learningjquery.com/2006/12/jquerify-bookmarklet"&gt;jQueryify&lt;/a&gt; – inject jQuery into any page, for testing through Firebug &lt;/li&gt;

      
&lt;li&gt;&lt;a href="http://www.selectorgadget.com/" mce_href="http://www.selectorgadget.com/"&gt;SelectorGadget&lt;/a&gt; – Very helpful for learning selectors interactively 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Minify and &lt;/strong&gt;&lt;strong&gt;Combine your scripts&lt;/strong&gt; 
    
&lt;ul&gt;
      
&lt;li&gt;When using many plugins, you’ll end up with the same “bloat” that is often associated with ASP.NET AJAX (due to the Toolkit, not the base library) &lt;/li&gt;

      
&lt;li&gt;Read &lt;a href="http://encosia.com/2009/05/20/automatically-minify-and-combine-javascript-in-visual-studio/" mce_href="http://encosia.com/2009/05/20/automatically-minify-and-combine-javascript-in-visual-studio/"&gt;Automatically minify and combine JavaScript in Visual Studio&lt;/a&gt; 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Boost Serving Time&lt;/strong&gt; 
    
&lt;ul&gt;
      
&lt;li&gt;Use &lt;a href="http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/" mce_href="http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/"&gt;&lt;u&gt;the Google hosted version of jQuery&lt;/u&gt;&lt;/a&gt; for public facing sites 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  
&lt;li&gt;&lt;strong&gt;Take advantage of JavaScript IntelliSense &lt;/strong&gt;
    
&lt;ul&gt;
      
&lt;li&gt;Get the &lt;a href="http://docs.jquery.com/Downloading_jQuery#Download_jQuery" mce_href="http://docs.jquery.com/Downloading_jQuery#Download_jQuery"&gt;jQuery vsdoc file&lt;/a&gt; &lt;/li&gt;

      
&lt;li&gt;Read &lt;a href="http://blogs.msdn.com/webdevtools/" mce_href="http://blogs.msdn.com/webdevtools/"&gt;Jeff King&lt;/a&gt;’s great &lt;a href="http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx" mce_href="http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx"&gt;FAQ detailing how common issues when configuring JavaScript IntelliSense&lt;/a&gt; &lt;/li&gt;

      
&lt;li&gt;If all else fails, just &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/06/21/vs-2008-javascript-intellisense.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/06/21/vs-2008-javascript-intellisense.aspx"&gt;/// &amp;lt;reference path=”~/path/to/jquery-1.3.2.vsdoc” /&amp;gt; in a JS include&lt;/a&gt; 
        &lt;br&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Other Resources Mentioned in the Show&lt;/h2&gt;

&lt;ul&gt;
  
&lt;li&gt;&lt;a href="http://aspnet.codeplex.com/Wiki/View.aspx?title=AJAX" mce_href="http://aspnet.codeplex.com/Wiki/View.aspx?title=AJAX"&gt;New Features in ASP.NET 4 AJAX&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://encosia.com/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/" mce_href="http://encosia.com/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/"&gt;Why ASP.NET AJAX UpdatePanels are dangerous&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://weblogs.asp.net/craigshoemaker/archive/2008/12/02/controlling-html-in-asp-net-webforms.aspx" mce_href="http://weblogs.asp.net/craigshoemaker/archive/2008/12/02/controlling-html-in-asp-net-webforms.aspx"&gt;Controlling HTML in ASP.NET WebForms&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://www.javascripttoolbox.com/jquery/cheatsheet/" mce_href="http://www.javascripttoolbox.com/jquery/cheatsheet/"&gt;jQuery 1.3.2 Cheat Sheet&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://www.cygen.com/dotnetiq/" mce_href="http://www.cygen.com/dotnetiq/"&gt;dotnetIQ: Learn .NET on your iPhone&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://feeds2.feedburner.com/PolymorphicPodcastFastFeed" mce_href="http://feeds2.feedburner.com/PolymorphicPodcastFastFeed"&gt;Polymorphic Podcast FastFeed&lt;/a&gt; &lt;/li&gt;

  
&lt;li&gt;&lt;a href="http://www.jsmag.com/" mce_href="http://www.jsmag.com/"&gt;JsMag&lt;/a&gt; is offering a discount (listen to the show for the coupon code!) &lt;/li&gt;
&lt;/ul&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7131982" width="1" height="1"&gt;</description><enclosure url="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-06-19-jquery.mp3" length="43311869" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Polymorphic+Podcast/default.aspx">Polymorphic Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>NetAdvantage ASP.NET in ASP.NET MVC</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/06/11/netadvantage-asp-net-in-asp-net-mvc.aspx</link><pubDate>Thu, 11 Jun 2009 17:01:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7117665</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7117665</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/06/11/netadvantage-asp-net-in-asp-net-mvc.aspx#comments</comments><description>&lt;p&gt;When I reported for Infragistics booth duty at TechEd 2009 the first person to walk up to me smiled and said, “So... what do you guys have for MVC?” Now I am pleased to announce I can do more than smile back. &lt;/p&gt;

&lt;p&gt;The following is a set guidance for working with the Infragistics NetAdvantage ASP.NET toolset in ASP.NET MVC. This guidance comes with articles (this being the first of many), how-to videos, a support forum, a downloadable sample application and a live version of the sample in the Infragistics Labs.&lt;/p&gt;

&lt;p&gt;To be clear this is not a set of new controls created for MVC. The example you see here, in the videos and the sample application were built using the &lt;a href="http://www.infragistics.com/dotnet/netadvantage/aspnet.aspx#Overview" mce_href="http://www.infragistics.com/dotnet/netadvantage/aspnet.aspx#Overview"&gt;NetAdvantage ASP.NET 2009 Vol. 1&lt;/a&gt; release of the toolset. What we are making available includes samples, guidance and a new control that helps decouple our server controls from WebForms dependencies.&lt;/p&gt;

&lt;p style="margin: 35px;"&gt;&lt;b&gt;As long as you focus on areas of the controls that do not initiate post backs or rely on ViewState, you soon find many behaviors and functions that work perfectly in an ASP.NET MVC application.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;As what is presented here is the meeting of two widely different architectures, we encourage and look forward to you feedback and suggestions. Please feel free to tell us how our existing controls may work better in MVC as well as ideas for new controls to more naturally fit the MVC approach.&lt;/p&gt;
&lt;h2&gt;Respecting the Culture While Keeping it Real&lt;/h2&gt;
&lt;p&gt;Simply put - server controls were never supposed to work in the MVC framework. In fact, some might consider it a bit of an unholy union to have &lt;a href="http://haacked.com/archive/2009/05/05/page-view-lockdown.aspx" mce_href="http://haacked.com/archive/2009/05/05/page-view-lockdown.aspx"&gt;declarative WebForms markup in a view page&lt;/a&gt;. While you can’t help but respect the spirit of these perspectives, sometimes there are exceptions.&lt;/p&gt;

&lt;p&gt;We recognize that there are many thousands of existing Infragistics customers who may want to use ASP.NET MVC. These developers want to get the most out of their investment by using the toolset wherever possible, regardless of the type of application they are building. Therefore Infragistics is extending the reach of our traditional toolset while looking toward the future of building some new controls that do not rely on ViewState or post backs.&lt;/p&gt;

&lt;p&gt;Brace yourself - the examples that follow include ASPX markup in the view. The markup is necessary to host WebForms controls in MVC, but the purpose is limited. The purpose of this code serves to merely instantiate the UI objects on the page. What you do not see are big blocks of logic in the UI – separation of concerns is preserved.&lt;/p&gt;

&lt;p&gt;In the end what the markup is fulfilling an equivalent role of HtmlHelper extension methods.&lt;/p&gt;
&lt;h2&gt;Hello World&lt;/h2&gt;
&lt;p&gt;To get you acquainted with what’s involved, consider a page that has an instance of the WebDataGrid that renders a list of contacts to the user.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/wdg-hellworld.png" style="border-width: 0px; display: inline;" title="WebDataGrid MVC Hello World" alt="WebDataGrid MVC Hello World" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/wdg-hellworld.png" border="0" width="596" height="655"&gt;&lt;/p&gt;
&lt;h3&gt;View Model&lt;/h3&gt;
&lt;p&gt;This class simply models the data that the view page needs to render correctly. A list of &lt;b&gt;Person&lt;/b&gt; types is expected in the &lt;b&gt;People&lt;/b&gt; property.&lt;/p&gt;

&lt;pre style="margin: 5px; padding: 5px; background-color: rgb(238, 238, 238);"&gt;public class WdgBasicView&lt;br&gt;{&lt;br&gt;    public IList&lt;person&gt; People { get; set; }&lt;br&gt;}&lt;br&gt;&lt;/person&gt;&lt;/pre&gt;
&lt;h3&gt;Controller&lt;/h3&gt;
&lt;p&gt;The controller creates a new instance of the view model and fills the object with the appropriate data objects.&lt;/p&gt;

&lt;pre style="margin: 5px; padding: 5px; background-color: rgb(238, 238, 238);"&gt;public class WdgController : Controller&lt;br&gt;{&lt;br&gt;    public ActionResult Index()&lt;br&gt;    {&lt;br&gt;        var vm = new WdgBasicView();&lt;br&gt;        vm.People = FakeRepository&lt;person&gt;.Create().Add(10).GetAll();&lt;br&gt;        return View(vm);&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/person&gt;&lt;/pre&gt;
&lt;h3&gt;View&lt;/h3&gt;
&lt;p&gt;The markup for the WebDataGrid is just like what you are accustomed to find in a WebForms page. Having this markup on the page gives you the flexibility to easily change the appearance and behavior of the control.&lt;/p&gt;

&lt;p&gt;Notice the declaration of the IGMvcScriptManager control. This control is responsible for interrogating any Infragistics controls on the page for the script references the ASP.NET AJAX ScriptManager would normally generate. The script references are then generated and emitted to the page. This control must be placed after any Infragistics controls in the markup so the controls are available in the DOM by the time the references are rendered.&lt;/p&gt;

&lt;pre style="margin: 5px; padding: 5px; background-color: rgb(238, 238, 238);"&gt;&amp;lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&amp;lt;MvcTest.Models.WdgBasicView&amp;gt;" %&amp;gt;&lt;br&gt;&amp;lt;%@ Register Assembly="Infragistics.Web.Mvc" Namespace="Infragistics.Web.Mvc" TagPrefix="cc1" %&amp;gt;&lt;br&gt;&amp;lt;%@ Register Assembly="Infragistics35.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"&lt;br&gt;    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;%&lt;br&gt;        wdg.DataSource = this.Model.People;&lt;br&gt;        wdg.DataBind();&lt;br&gt;    %&amp;gt;&lt;br&gt;&lt;br&gt;    &amp;lt;ig:WebDataGrid ID="wdg" &lt;br&gt;        runat="server" Width="50%" &lt;br&gt;        EnableViewState="false"&amp;gt;&lt;br&gt;    &amp;lt;/ig:WebDataGrid&amp;gt;&lt;br&gt;    &lt;br&gt;    &amp;lt;cc1:IGMvcScriptManager ID="sm" runat="server" /&amp;gt;&lt;br&gt;    &lt;br&gt;&amp;lt;/asp:Content&amp;gt;&lt;br&gt;&lt;/pre&gt;
&lt;h2&gt;Adding Behavior&lt;/h2&gt;
&lt;p&gt;While the grid produced above is interesting, the real benefit comes when you begin to add some of the behaviors of the grid. Adjust the markup slightly by adding the following behaviors, and now your users may interact with individual grid cells on the client and adjust the column width.&lt;/p&gt;

&lt;pre style="margin: 5px; padding: 5px; background-color: rgb(238, 238, 238);"&gt;&amp;lt;ig:WebDataGrid ID="wdg"&lt;br&gt;    runat="server" Width="50%"&lt;br&gt;    EnableViewState="false"&amp;gt;&lt;br&gt;    &amp;lt;Behaviors&amp;gt;&lt;br&gt;        &amp;lt;ig:ColumnResizing /&amp;gt;&lt;br&gt;        &amp;lt;ig:Activation /&amp;gt;&lt;br&gt;    &amp;lt;/Behaviors&amp;gt;&lt;br&gt;&amp;lt;/ig:WebDataGrid&amp;gt;&lt;br&gt;&lt;/pre&gt;
&lt;h2&gt;Watch the Video&lt;/h2&gt;
&lt;p&gt;This above sample is implemented in this video.&lt;/p&gt;

&lt;p&gt;
&lt;object width="425" height="344"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/Y1neW48n8vU&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;
&lt;param name="allowFullScreen" value="true"&gt;
&lt;param name="allowscriptaccess" value="always"&gt;
&lt;embed src="http://www.youtube.com/v/Y1neW48n8vU&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" mce_src="http://www.youtube.com/v/Y1neW48n8vU&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;h2&gt;The Next Step: Issue Tracker Sample Application&lt;/h2&gt;
&lt;p&gt;To go beyond the simplicity of the Hello World sample above, we’ve created a sample issue tracker application that brings together a number of the Infragistics controls with ASP.NET MVC. &lt;/p&gt;

&lt;p&gt;You may get acquainted with the sample in the following ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://labs.infragistics.com/aspnetmvc/issuetracker/" mce_href="http://labs.infragistics.com/aspnetmvc/issuetracker/"&gt;Browse the live sample&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://netadvantagemvc.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28615" mce_href="http://netadvantagemvc.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28615"&gt;Download the code&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://weblogs.asp.net/aspnet/media/p/98916.aspx" mce_href="http://weblogs.asp.net/aspnet/media/p/98916.aspx"&gt;Watch video doing a code review of the application&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first page you encounter is the Issue List page. The WebDataGrid is responsible for rendering the table, and the WebChart control creates the pie graph visualizing the Issue Severity data.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueList.png" style="border-width: 0px; display: inline;" title="Issue List: Using the WebDataGrid and WebChart" alt="Issue List: Using the WebDataGrid and WebChart" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueList.png" border="0" width="600" height="666"&gt; &lt;/p&gt;

&lt;p&gt;To add issues to the list, the New Issue page features the WebDropDown, WebHTMLEditor and WebSlider controls.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/NewIssue.png" style="border-width: 0px; display: inline;" title="New Issues: Using the WebDropDown, W" alt="New Issues: Using the WebDropDown, W" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/NewIssue.png" border="0" width="600" height="695"&gt; &lt;/p&gt;

&lt;p&gt;The drop down has a list of the Issue Types available to the user. These types are presented in the drop down with a custom item template.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/NewIssue2.png" style="border-width: 0px; display: inline;" title="New Issue: WebDropDown custom item template" alt="New Issue: WebDropDown custom item template" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/NewIssue2.png" border="0" width="600" height="456"&gt; &lt;/p&gt;

&lt;p&gt;The Issue Types are maintained on a page that include the WebDataGrid with the RowEditTemplate enabled.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueTypes1.png" style="border-width: 0px; display: inline;" title="Issue Types: Using the WebDataGrid" alt="Issue Types: Using the WebDataGrid" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueTypes1.png" border="0" width="600" height="363"&gt; &lt;/p&gt;

&lt;p&gt;By double-clicking on the left-most column of the grid you have access to the grid’s data for editing.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueTypes2.png" style="border-width: 0px; display: inline;" title="Issue Types: Editing data using the RowEditTemplate" alt="Issue Types: Editing data using the RowEditTemplate" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueTypes2.png" border="0" width="600" height="363"&gt; &lt;/p&gt;

&lt;p&gt;By clicking on the Add button, the same template is made available to add items to the list.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueTypes3.png" style="border-width: 0px; display: inline;" title="IssueTypes: Using the RowEditTemplate to add items to the list" alt="IssueTypes: Using the RowEditTemplate to add items to the list" mce_src="http://media.infragistics.com/community/aspnet/articles/intro-na-mvc/IssueTypes3.png" border="0" width="600" height="363"&gt;&lt;/p&gt;

&lt;p&gt;For a more in-depth code review of the sample application watch the video on the Infragistics Community Site: &lt;a href="http://weblogs.asp.net/aspnet/media/p/98916.aspx" mce_href="http://weblogs.asp.net/aspnet/media/p/98916.aspx"&gt;Issue Tracker Sample: Using the WebClient Controls in ASP.NET MVC&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Support and Testing&lt;/h2&gt;
&lt;p&gt;There is no official support through the Infragistics Developer Support for the toolset in MVC at this time. We do, however, have a &lt;a href="http://blogs.infragistics.com/forums/369.aspx" mce_href="http://blogs.infragistics.com/forums/369.aspx"&gt;new support forum available for your questions surrounding NetAdvantage for ASP.NET in ASP.NET MVC&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Let Us Know&lt;/h2&gt;
&lt;p&gt;Please let us know what you think! Leave comments here, email me at cshoemaker [at] infragistics.com, or find any other to get in contact with us. We want to know about your experiences with this approach as well as your suggestions for new controls that more naturally fit the MVC model.&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.infragistics.com/dotnet/netadvantage/aspnet.aspx#Downloads" mce_href="http://www.infragistics.com/dotnet/netadvantage/aspnet.aspx#Downloads"&gt;NetAdvantage ASP.NET Evaluation&lt;/a&gt; &lt;/li&gt;

&lt;li&gt;Hello World 
    
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://media.infragistics.com/community/aspnet/codesamples/mvc-helloworld/mvc-helloworld.zip" mce_href="http://media.infragistics.com/community/aspnet/codesamples/mvc-helloworld/mvc-helloworld.zip"&gt;Code Download&lt;/a&gt; &lt;/li&gt;

&lt;li&gt;&lt;a href="http://weblogs.asp.net/aspnet/media/p/98918.aspx" mce_href="http://weblogs.asp.net/aspnet/media/p/98918.aspx"&gt;Video&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;Issue Tracker Sample Application 
    
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://labs.infragistics.com/aspnetmvc/issuetracker/" mce_href="http://labs.infragistics.com/aspnetmvc/issuetracker/"&gt;Live sample&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://netadvantagemvc.codeplex.com/" mce_href="http://netadvantagemvc.codeplex.com/"&gt;CodePlex Project&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://weblogs.asp.net/aspnet/media/p/98916.aspx" mce_href="http://weblogs.asp.net/aspnet/media/p/98916.aspx"&gt;Video&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;&lt;a href="http://blogs.infragistics.com/forums/369.aspx" mce_href="http://blogs.infragistics.com/forums/369.aspx"&gt;Support Forum&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7117665" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Infragistics/default.aspx">Infragistics</category></item><item><title>Exploring ASP.NET MVC 1.0</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/04/29/exploring-asp-net-mvc-1-0.aspx</link><pubDate>Wed, 29 Apr 2009 15:20:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7064643</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=7064643</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/04/29/exploring-asp-net-mvc-1-0.aspx#comments</comments><description>
&lt;p&gt;&lt;a href="http://polymorphicpodcast.com/shows/aspnetmvc1/"&gt;&lt;img src="http://polymorphicpodcast.com/images/ListenBanner.png" title="Listen to the Show" alt="Listen to the Show" mce_src="http://polymorphicpodcast.com/images/ListenBanner.png" border="0" width="378" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Be sure to check out the &lt;a href="http://feeds2.feedburner.com/PolymorphicPodcastFastFeed"&gt;Fast Feed&lt;/a&gt; if your are looking for the same content in 3/4th the time!&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Our Guests&lt;/h2&gt;
&lt;p&gt;Join &lt;a href="http://jeffreypalermo.com/"&gt;Jeffrey Palermo&lt;/a&gt; and &lt;a href="http://www.lostechies.com/blogs/hex/"&gt;Eric Hexter&lt;/a&gt; as they discuss the release version of ASP.NET MVC and some practical examples real-world development.&lt;/p&gt;

&lt;h3&gt;Action Filters&lt;/h3&gt;  
&lt;p&gt;Action filters are extensibility points into the lifecycle of a controller request. There are many great resources that show how to use action filters:&lt;/p&gt;
  
&lt;ul&gt;   
&lt;li&gt;&lt;a href="http://www.squaredroot.com/post/2008/04/MVC-Error-Handler-Filter.aspx"&gt;MVC: Action Filter for Handling Errors&lt;/a&gt; &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://www.singingeels.com/Articles/Logging_with_ASPNET_MVC_Action_Filters.aspx"&gt;Logging with ASP.NET MVC Action Filters&lt;/a&gt; &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://haacked.com/archive/2008/08/14/aspnetmvc-filters.aspx"&gt;Filters in ASP.NET MVC&lt;/a&gt; &lt;/li&gt;
 &lt;/ul&gt;
  
&lt;p&gt;... and the following is a list of the interfaces you can leverage to tap into the requests:&lt;/p&gt;
  
&lt;ul&gt;   
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.iexceptionfilter.aspx"&gt;IExceptionFilter&lt;/a&gt; &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://weblogs.asp.net/controlpanel/blogs/IAuthorizationFilter"&gt;IAuthorizationFilter&lt;/a&gt; &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.iactionfilter.aspx"&gt;IActionFilter&lt;/a&gt; &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.iresultfilter.aspx"&gt;IResultFilter&lt;/a&gt; &lt;/li&gt;
 &lt;/ul&gt;
  &lt;h3&gt;Action Selectors &lt;/h3&gt;  
&lt;p&gt;Another way to gain control over a request is to pipe into action selectors. This gives you control to decide if an which HTTP verbs an action accepts. For more information on configuring action selectors, check out the following posts:&lt;/p&gt;
  
&lt;ul&gt;   
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/dd695917.aspx"&gt;The Life And Times of an ASP.NET MVC Controller&lt;/a&gt;&lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://codeclimber.net.nz/archive/2009/04/08/13-asp.net-mvc-extensibility-points-you-have-to-know.aspx"&gt;13 ASP.NET MVC extensibility points you have to know&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
  &lt;h3&gt;Pain Points? We Don't Have no Stinkin' Pain Points!&lt;/h3&gt;  
&lt;p&gt;When I asked Jeffery and Eric what the remaining pain points of ASP.NET MVC were, I got a surprising response – none. Since the framework is interface-based    &lt;br&gt;top-to-bottom features are pluggable at every level. If the framework doesn't provide something needed - you may extend any portion of framework when necessary.&lt;/p&gt;
  
&lt;p&gt;After being pushed, Eric did mention that he would like to see &lt;a href="http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx"&gt;areas in MVC&lt;/a&gt;. Areas will allow you to group controllers and they are likely to appear in MVC v2.&amp;nbsp; For now Eric has extended &lt;a href="http://209.85.173.132/search?q=cache:5kaGlr6IVBoJ:blog.codeville.net/2008/11/05/app-areas-in-aspnet-mvc-take-2/+areas+in+asp.net+mvc&amp;amp;cd=1&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&amp;amp;client=firefox-a"&gt;Steve Sanderson’s implementation of areas&lt;/a&gt; (link is a Google cache link since the site seems to be having issues lately).&lt;/p&gt;
  &lt;h3&gt;ASP.NET MVC in Action&lt;/h3&gt;  
&lt;p&gt;&lt;a href="http://jeffreypalermo.com/"&gt;Jeffrey Palermo&lt;/a&gt;, &lt;a href="http://flux88.com/"&gt;Ben Scheirman&lt;/a&gt; and &lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/"&gt;Jimmy Bogard&lt;/a&gt; bring you the upcoming ASP.NET MVC in Action from Manning:&lt;/p&gt;
 &lt;iframe src="http://rcm.amazon.com/e/cm?t=drazz75-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=as1&amp;amp;asins=1933988622&amp;amp;md=10FE9736YVPPT7A0FBG2&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr" style="width: 120px; height: 240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"&gt;&lt;/iframe&gt;  &lt;h3&gt;Headspring Development Stack&lt;/h3&gt;  
&lt;p&gt;The guys at &lt;a href="http://www.headspringsystems.com/"&gt;Headspring Systems&lt;/a&gt; have a full stack of open source software that they use to help start and support applications:&lt;/p&gt;
  
&lt;ul&gt;   
&lt;li&gt;&lt;a href="http://solutionfactory.codeplex.com/"&gt;SolutionFactory&lt;/a&gt;: Visual Studio add-in that exports a solution into a multi-project template &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://watin.sourceforge.net/"&gt;Watin&lt;/a&gt;: .NET automated web application testing &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://www.codeplex.com/AutoMapper"&gt;AutoMapper&lt;/a&gt;: Object-to-object mapping strategy &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://www.gallio.org/"&gt;Gallio&lt;/a&gt;:&amp;nbsp; Test automation platform &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://www.mbunit.com/"&gt;MbUnit&lt;/a&gt;: Unit test framework &lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://docs.jquery.com/QUnit"&gt;qUnit&lt;/a&gt;: jQuery unit test framework &lt;/li&gt;
 &lt;/ul&gt;
 
&lt;hr&gt;
&lt;h2&gt;Also on the Show&lt;/h2&gt;
&lt;h3&gt;Why isn’t Learning ASP.NET MVC Pragmatic Advice?&lt;/h3&gt;  
&lt;p&gt;&lt;a href="http://blog.wekeroad.com/blog/i-spose-ill-just-say-it-you-should-learn-mvc/"&gt;Rob Conery&lt;/a&gt; and &lt;a href="http://blog.theaccidentalgeek.com/post/2009/04/23/I-Spose-Irsquo3bll-Just-Say-It-Still-Waiting-For-a-GOOD-Reason-to-Learn-MVC.aspx"&gt;Joe Brinkman&lt;/a&gt; recently engaged in a lively conversation on the merits (and reasons) for learning the ASP.NET MVC framework. If you are not careful the exchange may sound a bit like a shouting match, but these guys seem to be pretty comfortable with one another. but in the end if you pull anything out of it, I think it’s best summed by by Rob:&lt;/p&gt;
  
&lt;blockquote&gt;   
&lt;p&gt;You Should &lt;strong&gt;Learn&lt;/strong&gt; MVC – not that you have to use it (although I wish you would – it’s tons of fun!)&lt;/p&gt;
 &lt;/blockquote&gt;
  
&lt;p&gt;The often hailed wisdom from page ‘Pragmatic Programmer’ states:&lt;/p&gt;
  
&lt;blockquote&gt;   
&lt;p&gt;&lt;strong&gt;Learn at least one new language every year.&lt;/strong&gt; Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut. Additionally, learning many languages is far easier now, thanks to the wealth of freely available software on the Internet.&lt;/p&gt;
 &lt;/blockquote&gt;
  
&lt;p&gt;While MVC is not a new language per se, but every ASP.NET developer should spend time with the framework – if not to use, then at least it to sharpen your development arsenal.&lt;/p&gt;
  
&lt;p&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=drazz75-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=as1&amp;amp;asins=020161622X&amp;amp;md=10FE9736YVPPT7A0FBG2&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr" style="width: 120px; height: 240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7064643" width="1" height="1"&gt;</description><enclosure url="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2009-04-28-aspnetmvc1.mp3" length="45275389" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Polymorphic+Podcast/default.aspx">Polymorphic Podcast</category></item><item><title>Secrets of Real World ASP.NET Dynamic Data Websites eBook Now Available</title><link>http://weblogs.asp.net/craigshoemaker/archive/2009/03/25/secrets-of-real-world-asp-net-dynamic-data-websites-ebook-now-available.aspx</link><pubDate>Wed, 25 Mar 2009 13:38:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6999889</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=6999889</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2009/03/25/secrets-of-real-world-asp-net-dynamic-data-websites-ebook-now-available.aspx#comments</comments><description>
&lt;p&gt;I am pleased to announce that &lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/Secrets-of-Real-World-ASP-NET-Dynamic-Data-Websites.productCd-047045735X.html" mce_href="http://www.wrox.com/WileyCDA/WroxTitle/Secrets-of-Real-World-ASP-NET-Dynamic-Data-Websites.productCd-047045735X.html"&gt;Secrets of Real World ASP.NET Dynamic Data Websites&lt;/a&gt; is now available as a &lt;a href="http://wrox.com/go/blox" mce_href="http://wrox.com/go/blox"&gt;Wrox Blox ebook&lt;/a&gt;. The material for this book is largely pulled from the recent talks I’ve given at various user groups and developer conferences on the same topic.&lt;/p&gt;

&lt;p&gt;In this book you learn the basics of Dynamic Data and quickly move into how to leverage the features in some practical scenarios. If you’ve ever looked at Dynamic Data and wondered:&lt;/p&gt;

&lt;ul&gt;
  
&lt;li&gt;How do I move the data context to a lower application level and out of the web layer?&lt;/li&gt;

  
&lt;li&gt;How do I execute custom business layer logic against the Dynamic Data controls?&lt;/li&gt;

  
&lt;li&gt;How do I build reusable and programmatically customizable field templates?&lt;/li&gt;

  
&lt;li&gt;How do I secure Dynamic Data scaffolding using ASP.NET membership services?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;... then this book is for you!&lt;/p&gt;

&lt;p&gt;The price tag is reasonable – well under $10 – no too bad for a technology book!&lt;/p&gt;

&lt;p&gt;If you are interested in the full talk, feel free to contact me (&lt;a href="http://twitter.com/craigshoemaker/" mce_href="http://twitter.com/craigshoemaker/"&gt;&lt;img src="http://polymorphicpodcast.com/images/icons/fav-twitter.png" mce_src="http://polymorphicpodcast.com/images/icons/fav-twitter.png" style="margin: 0px; padding: 0px;" border="0"&gt;&lt;/a&gt; &lt;a href="http://twitter.com/craigshoemaker/" mce_href="http://twitter.com/craigshoemaker/"&gt;@craigshoemaker&lt;/a&gt; or &lt;a href="http://weblogs.asp.net/craigshoemaker/contact.aspx" mce_href="http://weblogs.asp.net/craigshoemaker/contact.aspx"&gt;my contact page&lt;/a&gt;) and maybe we can work out a remote lunch-n-learn type presentation. Better yet, if you are local to Southern California perhaps we can work out something in person.&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6999889" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Community+News/default.aspx">Community News</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category></item><item><title>ASP.NET 4.0 and Visual Studio 2010 Enhancements</title><link>http://weblogs.asp.net/craigshoemaker/archive/2008/12/19/asp-net-4-0-and-visual-studio-2010-enhancements.aspx</link><pubDate>Fri, 19 Dec 2008 13:48:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6798253</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=6798253</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2008/12/19/asp-net-4-0-and-visual-studio-2010-enhancements.aspx#comments</comments><description>
&lt;p&gt;&lt;a href="http://blogs.msdn.com/scothu/"&gt;Scott Hunter&lt;/a&gt; brings a summary of the new features coming in ASP.NET 4.0 and Visual Studio 2010. Learn why you'll never have to type runat="server" again!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://getpixel8ed.com/shows/aspnet-4-preview" mce_href="http://getpixel8ed.com/shows/aspnet-4-preview"&gt;&lt;img src="http://download.infragistics.com/users/pixel8/images/pixel8podcast.png" mce_src="http://download.infragistics.com/users/pixel8/images/pixel8podcast.png" border="0" width="276" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a href="http://getpixel8ed.com/shows/aspnet-4-preview" mce_href="http://getpixel8ed.com/shows/aspnet-4-preview"&gt;Listen to the Show!&lt;/a&gt;&lt;/h3&gt;
&lt;h2&gt;Visual Studio 2010&lt;/h2&gt;
&lt;p&gt;Visual Studio 2010 will feature expanded snippets available
in the HTML editor window. These snippets will dramatically change the way you
write ASPX markup. For instance, if you were to add a TextBox to the page as
soon as you begin typing &lt;span class="codeSnip"&gt;&amp;lt;asp:TextBox...&lt;/span&gt; the snippet will take over and add in
the &lt;span class="codeSnip"&gt;ID&lt;/span&gt; and &lt;span class="codeSnip"&gt;runat&lt;/span&gt; attribute.&lt;/p&gt;

&lt;p&gt;Further, consider adding a &lt;span class="codeSnip"&gt;RequiredFieldValidator&lt;/span&gt; to the
page and the amount of work required in the past to properly configure the
control. With the new snippets if you add a validator directly next to the
&lt;span class="codeSnip"&gt;TextBox&lt;/span&gt; you created previously, the snippet will automatically fill out the
markup for the control, populating the &lt;span class="codeSnip"&gt;ControlToValidate&lt;/span&gt; attribute, add the &lt;span class="codeSnip"&gt;id&lt;/span&gt;
and &lt;span class="codeSnip"&gt;runat&lt;/span&gt; attributes and position your cursor inside the &lt;span class="codeSnip"&gt;ErrorMessage&lt;/span&gt;
attribute. Hand-coding has never been so easy!&lt;/p&gt;

&lt;p&gt;Note: You’ll never have to type &lt;span class="codeSnip"&gt;runat="server"&lt;/span&gt; again!&lt;/p&gt;

&lt;p&gt;Further enhancements include the ability to triple-click an expansive
element like a table and the editor selects the entire table’s markup. Want to
surround that table with some additional markup? Just start typing with the
table selected and your markup is inserted around the selected code.&lt;/p&gt;

&lt;h2&gt;ASP.NET Innovation&lt;/h2&gt;
&lt;p&gt;The ASP.NET platform has enjoyed a number of out-of-band
updates in the form of AJAX, Dynamic Data and MVC, but the core of WebForms has
remained without an update for a while. The reason is that the core of WebForms
is dependent on System.Web, which is loaded by IIS. &lt;/p&gt;

&lt;p&gt;This limitation has the attention of the ASP.NET team and in
the future they are looking for ways to ship out-of-band releases on the core
of WebForms. Until then we wait for the official release of ASP.NET 4.0 which
will include the follow updates to WebForms:&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;&lt;b&gt;Control of Control IDs&lt;/b&gt;: ASP.NET developers will finally have
     total control over the ClientID that is rendered to the page for each
     control. For simple scenarios you simply provide the ID value and in a
     data-bound context you can provide the key and replacement tag. For
     instance if you have a control in a data-bound control and you want the
     key to be "lbl" then the controls will have IDs consistent with lbl1,
     lbl2, lbl3 and so on.&lt;br&gt;&lt;br&gt;
     Scott Galloway has an excellent post on the upcoming client ID changes: &lt;a href="http://www.mostlylucid.net/archive/2008/11/03/way-too-much-information-on-control-ids-and-asp.net-4.0.aspx" mce_href="http://www.mostlylucid.net/archive/2008/11/03/way-too-much-information-on-control-ids-and-asp.net-4.0.aspx"&gt;Way too much information on Control IDs and ASP.NET 4.0 Client Id Enhancements&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;b&gt;Humble ViewState&lt;/b&gt;: Programming on the web often requires
     storing state somewhere. Using session state is prone to timeouts and can
     create problems in a server farm/garden environment. Many times the best
     place to persist data is in the HTML document itself. This logic is what drove the ASP.NET
     team to first implement ViewState, but an eager implementation (requiring
     parent controls to enable ViewState and other requirements) created bloated pages with
     unnecessary ViewState shoved up to the client.&lt;br&gt;&lt;br&gt;
     The next generation of ViewState allows for granular control over which
     controls require ViewState. The default template for "4.0" project may
     even have ViewState turned off by default.&lt;br&gt;&lt;br&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;b&gt;Dynamic Image Support&lt;/b&gt;: ASP.NET will feature rich image support
     giving developers an easy way to manipulate and maintain images on the
     web. Features include an image handler base class that is responsible for
     converting byte arrays to images and back again. A server control that
     calls the handler and helps pass parameters for uniquely identifying image
     data as well as stamping for cache support. The cache may be configured to
     cache on the server, the client or in both locations. Images are
     manipulated by a set of transforms which include resizing and watermarking
     among others.&lt;br&gt;&lt;br&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;b&gt;IQueryable BusinessLogicDataSource&lt;/b&gt;: This new data source will
     feature query blocks which expose a declarative LINQ syntax to help create
     dynamic where clauses to append to search queries. The SearchExpression
     query block allows you to easily add "starts with", "ends with" and
     "contains" type of constraints to a query. The RangeExpression will read
     minimum and maximum values to constrain the range of a field. The LINQ
     syntax is generated when the page data binds sends the fully-constrained
     to the query to the server once all the parameters are known. Attributes
     associated with methods on the business logic layer will tell the data
     source which methods to run to select, insert, update and delete objects.
     The data source will work against a provider to interface with Linq to
     SQL, Linq to Enties, POCOs and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Dynamic Data&lt;/h2&gt;
&lt;p&gt;The Dynamic Data updates are spread among solutions for
WebForms as well as MVC. Really the term "Dynamic Data" does injustice to the
features as really they are becoming simply features of existing and new
controls which are really just ASP.NET data controls.&lt;/p&gt;

&lt;p&gt;For what you think of today as Dynamic Data, expect to see
further work in the following areas:&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;&lt;b&gt;Entity Templates&lt;/b&gt;: Much like a field template, but more of a
     container for markup and DynamicControls which can provide templating for
     an entire row of data rather than a single field.&lt;br&gt;&lt;br&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;b&gt;Database Inheritance&lt;/b&gt;: Provide scaffold pages that will
     recognize database inheritance and provide CRUD capabilities for these
     tables.&lt;br&gt;&lt;br&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;b&gt;Many to Many Relationships&lt;/b&gt;: Scaffolding will render check box
     lists to allow selection of many to many related data. (David Ebbo writes
     about this new feature in: &lt;a href="http://blogs.msdn.com/davidebb/archive/2008/10/25/a-many-to-many-field-template-for-dynamic-data.aspx" mce_href="http://blogs.msdn.com/davidebb/archive/2008/10/25/a-many-to-many-field-template-for-dynamic-data.aspx"&gt;A
     ‘Many To Many’ field template for Dynamic Data&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Use the Dynamic Control in a non-List Scenario?&lt;/h3&gt;
&lt;p&gt;The team is working on strategies for using the
DynamicControl in situations where you are displaying a single record (and are
outside the context of a list control).&lt;/p&gt;

&lt;p&gt;Today a single record would bind to the FormView which
supports the DynamicControl. Unfortunately FormView renders as a table in order
provide places to hook in CSS classes. The FormView will soon feature a mode
where you can turn off markup rendering all together so only the markup you
provide is rendered.&lt;/p&gt;

&lt;p&gt;There is talk among Scott and his team of the creation of an ItemView which may be a more natural fit for this type of scenario to
compliment the &lt;span class="codeSnip"&gt;ListView&lt;/span&gt; control.&lt;/p&gt;

&lt;h2&gt;Dyanmic Data &amp;amp; MVC&lt;/h2&gt;
&lt;p&gt;Out of respect of the culture surrounding MVC the team has
chosen to implement Dynamic Data support backward to MVC. They began with
adding HTML helpers and implementations for field/entity templates and
databinding logic, leaving scaffolding for the end. This will ensure that
Dynamic Data will work under MVC for those who choose to opt out of the
scaffolding features.&lt;/p&gt;

&lt;p&gt;In a seemingly controversial move, the team is implementing
a version of ViewState for MVC! While the implementation details differ from
traditional ViewState found in WebForms the technique of state persistence in a
hidden HTML element will find its way to MVC.&lt;/p&gt;

&lt;p&gt;In the interview, Scott poses the question of how one might implement
optimistic concurrency in an MVC application. You may choose to implement a
time stamp field or set aside the previous values for later comparison. If you
choose to review old values then the state of this object must persist
somewhere. So the team is looking to support developers who may choose a number
of different approaches to the same problem.&lt;/p&gt;

&lt;p&gt;Future Dynamic Data implementations for MVC will feature a
controller with virtual methods for insert, update and delete. Using virtual methods
obviously means that developers will have the option to over-ride and replace
any methods they see fit.&lt;/p&gt;

&lt;div&gt;&lt;b&gt;Update:&lt;/b&gt; &lt;a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=20628?" mce_href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=20628?"&gt;Check out Dynamic Data Preview 2&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul&gt;
    
&lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&amp;amp;displaylang=en"&gt;Microsoft Pre-release Software Visual Studio 2010 and .NET Framework 4.0 CTP&lt;/a&gt;&lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=18803" mce_href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=18803"&gt;ASP.NET Dynamic Data 4.0 Preview 1&lt;/a&gt;: Includes WebForms Dynamic Data futures and Dynamic Data/MVC blog sample&lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=WebForms&amp;amp;referringTitle=Home" mce_href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=WebForms&amp;amp;referringTitle=Home"&gt;WebForms Updates&lt;/a&gt;&lt;/li&gt;
    
&lt;li&gt;&lt;a href="http://codeplex.com/aspnet" mce_href="http://codeplex.com/aspnet"&gt;ASP.NET Codeplex Home&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=20628?" mce_href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=20628?"&gt;Dynamic Data Preview 2&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6798253" width="1" height="1"&gt;</description><enclosure url="http://download.infragistics.com/pixel8/media/pixel8-2008-12-18-aspnet-4-preview.mp3" length="37505382" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Pixel8/default.aspx">Pixel8</category></item><item><title>Controlling HTML in ASP.NET WebForms</title><link>http://weblogs.asp.net/craigshoemaker/archive/2008/12/02/controlling-html-in-asp-net-webforms.aspx</link><pubDate>Tue, 02 Dec 2008 14:44:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6762751</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=6762751</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2008/12/02/controlling-html-in-asp-net-webforms.aspx#comments</comments><description>
&lt;p&gt;&lt;a href="http://polymorphicpodcast.com/shows/controlhtml/"&gt;&lt;img src="http://polymorphicpodcast.com/images/ListenBanner.png" title="Listen to the Show" alt="Listen to the Show" mce_src="http://polymorphicpodcast.com/images/ListenBanner.png" width="378" border="0" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a href="http://polymorphicpodcast.com/shows/controlhtml/"&gt;Listen to the Show!&lt;/a&gt;&lt;/h3&gt;
&lt;h4&gt;Resources Mentioned in the Show&lt;/h4&gt;
&lt;ul&gt;
 
&lt;li&gt;&lt;a href="http://getpixel8ed.com/shows/scottguthrie08"&gt;Interview with Scott Guthrie&lt;/a&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://polymorphicpodcast.com/shows/aspnetseo/"&gt;ASP.NET SEO&lt;/a&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://weblogs.asp.net/craigshoemaker/archive/2008/11/21/the-illusion-of-persistence-saving-test-data.aspx"&gt;BookRepository&lt;/a&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://blogs.infragistics.com/blogs/cshoemaker/archive/2008/11/26/videos-implementing-an-ajax-live-form-with-netadvantage-webclient-controls.aspx"&gt;Implementing Ajax Live Form with NetAdvantage Controls&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr&gt;

&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fcraigshoemaker%2farchive%2f2008%2f12%2f02%2fcontrolling-html-in-asp-net-webforms.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fcraigshoemaker%2farchive%2f2008%2f12%2f02%2fcontrolling-html-in-asp-net-webforms.aspx" alt="kick it on DotNetKicks.com" border="0"&gt;&lt;/a&gt;

&lt;p&gt;Developers want control. Developing for the web is seemingly
more of a love/hate relationship with the tools at our disposal. Sometimes our
tools and frameworks give us power, but not control. While we love the functionality
and ease-of-use of many of the stock server controls found in ASP.NET WebForms,
sometimes we find that the underlying HTML isn’t exactly what we need.&lt;/p&gt;

&lt;p&gt;To address the growing need for more control over web page
markup we’ve seen movements like the &lt;a href="http://www.asp.net/CssAdapters/"&gt;CSS
Control Adapters&lt;/a&gt; and the emergence of &lt;a href="http://asp.net/mvc/"&gt;ASP.NET
MVC&lt;/a&gt; framework which give us 100% control over markup. &lt;/p&gt;

&lt;p&gt;MVC and control adapters are not the only answer to gaining
more control. For the sea of standard WebForm applications there are many techniques
available for gaining more control.&lt;/p&gt;

&lt;h2&gt;Tame ViewState&lt;/h2&gt;

&lt;p&gt;One of the first places to exercise control over your HTML
is to reign in ViewState. ViewState was once hailed as a huge time saver upon
its introduction and now often the bedrock feature of ASP.NET is maligned for
all manner of code bloat.&lt;/p&gt;

&lt;p&gt;The fact is, though, ViewState is not inherently evil and is
effective when used appropriately. The problem with ASP.NET is not that it
features ViewState, but that the framework is cavalier in its use of ViewState.
The problem is ViewState is turned on by default.&lt;/p&gt;

&lt;p&gt;Consider a page that includes a data-bound ListView control
using the default ASP.NET template. The page template and all controls automatically
have ViewState enabled.&lt;/p&gt;

&lt;p&gt;The following is a screen shot of the HTML generated by the
ListView:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/01-ViewStateBefore.png" alt="ViewSource created from ListView server control" width="650" border="0" height="462"&gt;&lt;/p&gt;

&lt;p&gt;Notice that the control simply renders a table. There is no
editing behavior implemented on this page therefore there is no need for
ViewState. Disabling ViewState will change the source to look like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/02-ViewStateAfter.png" alt="Reduced markup from disabling ViewState" width="650" border="0" height="382"&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: Surprisingly,
setting EnableViewState="false" does not get rid of ViewState entirely. If you
have a HTML form set to run-at server, then you will always have at least one
hidden control in your markup with some "ViewState" data. This data, though, is
trivial in size.&lt;/p&gt;

&lt;p style="border: 1px solid rgb(204, 204, 204); padding: 5px; background-color: rgb(255, 255, 204);"&gt;&lt;b&gt;Tip&lt;/b&gt;: Turn off
ViewState by default and use it only when necessary. You can even turn off
ViewState globally in your application by disabling it in the web.config in the
pages element.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/05-WebConfig.png" alt="Disable ViewState in the web.config" width="483" border="0" height="169"&gt;&lt;/p&gt;
    
&lt;p&gt;If you find ViewState is unavoidable in your application you may consider looking
into the options of moving it to the &lt;a href="http://www.hanselman.com/blog/MovingViewStateToTheSessionObjectAndMoreWrongheadedness.aspx"&gt;web server&lt;/a&gt; or even &lt;a href="http://www.geekzilla.co.uk/ViewFBFBED52-B8C5-4F55-B856-765FA719005B.htm"&gt;down to the database&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Question the Form Tag&lt;/h2&gt;

&lt;p&gt;Another foundational control in ASP.NET is the run-at server
form tag – but do you really need it? &lt;/p&gt;

&lt;p&gt;As you just saw when working with ViewState, as long as a
server-controlled form element is on your page, extra HTML in the form of
ViewState and supporting JavaScript for post backs is emitted to the page. The
default ASP.NET page template includes a form tag on every page, but often its
presence is not necessary.&lt;/p&gt;

&lt;p&gt;Returning to the example from the previous section, look at
the HTML generated from placing a read-only ListView in a server form with
ViewState disabled:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/03-FormTagBefore.png" alt="Markup with unneeded form element" width="650" border="0" height="367"&gt;&lt;/p&gt;

&lt;p&gt;This page has no input controls and is simply a read-only
page so having a form on the page doesn’t really make sense.&lt;/p&gt;

&lt;p&gt;The next screen shot is how the page looks with the form tag
removed:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/04-FormTagAfter.png" alt="Markup after removing unneeded form element" width="650" border="0" height="277"&gt;&lt;/p&gt;

&lt;p style="border: 1px solid rgb(204, 204, 204); padding: 5px; background-color: rgb(255, 255, 204);"&gt;&lt;b&gt;Tip&lt;/b&gt;: Remove
server-controlled forms from your page if they are not necessary. &lt;/p&gt;

&lt;p&gt;You may even consider removing them from your page first and
wait for the design to dictate whether or not you need a form on the page. Perhaps
you are even so bold as to edit the Visual Studio template to remove the form
tag from new pages?&lt;/p&gt;

&lt;p&gt;The template is found under this location:&lt;/p&gt;

&lt;p&gt;C:\Program Files\Microsoft Visual Studio
9.0\Web\WebNewFileItems\CSharp\WebForm.aspx&lt;/p&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;C:\Program Files\Microsoft Visual Studio
9.0\Web\WebNewFileItems\VB\WebForm.aspx&lt;/p&gt;

&lt;p&gt;&lt;b&gt;NOTE:&lt;/b&gt; If you edit
this file you are tinkering with Visual Studio’s default templates, which under
normal circumstances is probably a bad idea. The change suggested here, however
is pretty benign. In any event make backups - be certain of what you are doing,
and if something goes wrong don’t blame me :)&lt;/p&gt;

&lt;h2&gt;No-Markup Controls&lt;/h2&gt;

&lt;p&gt;Server controls are valuable because they create a layer of
abstraction above HTML elements. This abstraction determines how controls
render to different browser versions and save developers time from having to
write code by hand. While these benefits are realized in many situations,
sometimes server controls are just more than you need.&lt;/p&gt;

&lt;p&gt;I have often seen developers use inappropriate controls just
to get some text on the screen or to control the visibility of controls.&lt;/p&gt;

&lt;h3&gt;The Literal Control&lt;/h3&gt;

&lt;p&gt;&lt;i&gt;Do you need to render
a simple string to the page?&lt;/i&gt; Then don’t use a Label control unless you have
plans for the extra SPAN tags that come with the data – instead try using a
Literal control.&lt;/p&gt;

&lt;p&gt;The Literal control’s purpose is to render a string literal
to the page – and only the string literal.&lt;/p&gt;

&lt;p&gt;Take a look at the next two lines of ASPX code: &lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/09-LabelVsLiteralSource.png" alt="Literal vs Label control" width="650" border="0" height="85"&gt;&lt;/p&gt;

&lt;p&gt;The controls are effectively doing the same thing: rendering
a name to the page. The resulting HTML from each of these controls is quite
different:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/10-LabelVsLiteralMarkup.png" alt="Markup generated by a literal and label control" width="650" border="0" height="175"&gt;&lt;/p&gt;

&lt;p&gt;The Label is rendered with wrapping SPAN tags. In this case,
the control is on a page associated to a master page so the HTML bloats even
further with the unique client ID generated by the server. Often when using a
Label control developers do not use the accompanying HTML that’s rendered with
the data.&lt;/p&gt;

&lt;p&gt;Using the Literal control, however simply renders the text
to the screen as desired.&lt;/p&gt;

&lt;p style="border: 1px solid rgb(204, 204, 204); padding: 5px; background-color: rgb(255, 255, 204);"&gt;&lt;b&gt;Tip&lt;/b&gt;: Be aware of
when you simply need text on the page and use the appropriate controls.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: Take care
to not confuse the Literal control with a different control name &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.literalcontrol.aspx"&gt;LiteralControl&lt;/a&gt;.The
LiteralControl exists to aid server control construction and is rarely used
directly in code. &lt;/p&gt;

&lt;h3&gt;The Placeholder Control&lt;/h3&gt;

&lt;p&gt;&lt;i&gt;Do you need to
programmatically show or hide a group of controls?&lt;/i&gt; Don’t just make that DIV
runat="server" or turn to a Panel control – instead try wrapping your controls
in a Placeholder control.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/tety77hf%28VS.71%29.aspx"&gt;Placeholder
control&lt;/a&gt; is a very useful control that doesn’t seem to get a lot of
attention. What makes the Placeholder useful is that the control may contain
children controls and it renders no HTML to the page.&lt;/p&gt;

&lt;p&gt;Often Placeholders are used for template designs and other scenarios
where you don’t know which controls are needed until runtime. There are a
number of other applications for the Placeholder beyond its normal use. You can
also use this control to help control what is shown and hidden on your page.&lt;/p&gt;

&lt;p&gt;Consider the typical scenario where a message is initially
hidden from the user, but is later displayed on the screen. A common approach
to this problem is to create a server-controlled DIV on the page and set the
Visiblity property to false:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/06-DivSource.png" alt="DIV element set to run-at server" width="650" border="0" height="105"&gt;&lt;/p&gt;

&lt;p&gt;For simple pages the markup that is rendered to the page is
exactly what you would expect, but in more practical settings the HTML gets
altered.&lt;/p&gt;

&lt;p&gt;The next screenshot shows you how that DIV is rendered to
the page when the markup lives inside a master page:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/07-DivMarkup.png" alt="Resulting markup from server DIV element" width="650" border="0" height="116"&gt;&lt;/p&gt;

&lt;p&gt;The age-old problem of ASP.NET changing a control’s ID
creeps up. This is a problem because once you start interacting with style
sheets and JavaScript the client IDs become very important. While there are a
number of ways around this issue for both CSS and scripting, why not dodge the
problem altogether?&lt;/p&gt;

&lt;p&gt;Instead of making the DIV a server control, wrap your
content inside a Placeholder and then you have the same programmatic control
over the block of controls without having to worry about the HTML being
affected.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/08-PlaceholderSource.png" alt="" width="650" border="0" height="132"&gt;&lt;/p&gt;

&lt;p&gt;You could also use the &lt;a href="http://www.beansoftware.com/ASP.NET-Tutorials/MultiView-Control.aspx"&gt;MultiView
control&lt;/a&gt; to accomplish this same behavior without generating any extra
markup.&lt;/p&gt;

&lt;p style="border: 1px solid rgb(204, 204, 204); padding: 5px; background-color: rgb(255, 255, 204);"&gt;&lt;b&gt;Tip&lt;/b&gt;: Use controls
that do not generate HTML wherever appropriate.&lt;/p&gt;

&lt;h2&gt;Expressions Have No Ego&lt;/h2&gt;

&lt;p&gt;If you truly don’t need extra markup created for you –
consider skipping the use of a server control altogether and use in-line
expressions. ASP.NET MVC makes heavy use of expressions and while some think
heavy use can create messy co-mingled code – there is a good pragmatic reason
for using them.&lt;/p&gt;

&lt;p&gt;If you use a server control, you have to have some strategy for
providing the control with data. Getting data into the control requires you to
write code in the codebehind. Writing code is not a bad practice at all – it
can just be time-consuming. Depending on where the control resides on the page
you will often have to do most if not all of these steps:&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;Declaring a control in the
     ASPX&lt;/li&gt;
 
&lt;li&gt;Finding the appropriate
     event method in the page lifecycle to tap into &lt;/li&gt;
 
&lt;li&gt;Locating and cast the
     control to the appropriate type (in some cases)&lt;/li&gt;
 
&lt;li&gt;Provide the control with
     data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you opt for using expressions instead you can simply
inject the data exactly where it need to go.&lt;/p&gt;

&lt;p&gt;So instead of doing this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/11-SevercontrolSource.png" alt="" width="650" border="0" height="103"&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/14-ServerControlCodebehind.png" alt="" width="650" border="0" height="176"&gt;&lt;/p&gt;

&lt;p&gt;Try doing this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/13-ExpressionSource.png" alt="" width="650" border="0" height="81"&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://polymorphicpodcast.com/images/blog/controlhtml/12-ExpressionCodebehind.png" alt="" width="650" border="0" height="132"&gt;&lt;/p&gt;

&lt;p&gt;In the end you’ll find that not using server controls when
they are truly unnecessary will help tame your rendered markup significantly.&lt;/p&gt;

&lt;h2&gt;Choose Controls Wisely&lt;/h2&gt;

&lt;p&gt;One of the best ways to control the HTML that your pages
generate is to be familiar with what common controls with render. The following
tables contain an abbreviated list of ASP.NET server controls and a summary of
the type of markup they emit.&lt;/p&gt;

&lt;h3&gt;Standard Controls&lt;/h3&gt;

&lt;table style="border-collapse: collapse;" width="80%" border="1" cellpadding="3" cellspacing="3"&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;th&gt;Control Name&lt;/th&gt;
  &lt;th&gt;Renders&lt;/th&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Label&lt;/td&gt;
  
&lt;td&gt;SPAN elements surrounding Text property value&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;TextBox&lt;/td&gt;
  
&lt;td&gt;HTML text input element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Button&lt;/td&gt;
  
&lt;td&gt;HTML button input element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;LinkButton&lt;/td&gt;
  
&lt;td&gt;Anchor element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;ImageButton&lt;/td&gt;
  
&lt;td&gt;Anchor and image (IMG) elements&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;HyperLink&lt;/td&gt;
  
&lt;td&gt;Anchor element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;DropDownList&lt;/td&gt;
  
&lt;td&gt;Select element with options for values&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;ListBox&lt;/td&gt;
  
&lt;td&gt;Select element with option tags for values. (The ListBox
  renders a value for the SIZE attribute allowing more than one option to
  appear at a time.)&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;CheckBox&lt;/td&gt;
  
&lt;td&gt;HTML checkbox input element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;CheckBoxList&lt;/td&gt;
  
&lt;td&gt;If RepeatLayout is set to Table, then the control renders
  standard table markup with the checkbox input elements.
  If RepeatLayout is set to Flow, then the control renders a
  series of Label and BR elements with the checkbox input elements.&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;RadioButton&lt;/td&gt;
  
&lt;td&gt;HTML radio input element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;RadioButtonList&lt;/td&gt;
  
&lt;td&gt;If RepeatLayout is set to Table, then the control renders
  standard table markup with the radio input elements.
  If RepeatLayout is set to Flow, then the control renders a
  series of Label and BR elements with the radio input elements.&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Image&lt;/td&gt;
  
&lt;td&gt;IMG element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;ImageMap&lt;/td&gt;
  
&lt;td&gt;IMG element and MAP element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Table&lt;/td&gt;
  
&lt;td&gt;HTML table&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;BulletedList&lt;/td&gt;
  
&lt;td&gt;Series of LI elements inside a UL element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;HiddenField&lt;/td&gt;
  
&lt;td&gt;HTML hidden input element&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr style="background-color: rgb(255, 255, 204);"&gt;
  
&lt;td&gt;Literal&lt;/td&gt;
  
&lt;td&gt;N/A&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Calendar&lt;/td&gt;
  
&lt;td&gt;Complex series of elements including links and table markup&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;AdRotator&lt;/td&gt;
  
&lt;td&gt;Anchor and image elements&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Wizard&lt;/td&gt;
  
&lt;td&gt;Complex series of elements including links and table
  markup&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr style="background-color: rgb(255, 255, 204);"&gt;
  
&lt;td&gt;MultiView&lt;/td&gt;
  
&lt;td&gt;N/A&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;Panel&lt;/td&gt;
  
&lt;td&gt;DIV or Table element depending on the browser capabilities&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr style="background-color: rgb(255, 255, 204);"&gt;
  
&lt;td&gt;Placeholder&lt;/td&gt;
  
&lt;td&gt;N/A&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;h3&gt;Data Controls&lt;/h3&gt;

&lt;table style="border-collapse: collapse;" width="80%" border="1" cellpadding="3" cellspacing="3"&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  
&lt;td&gt;Control Name&lt;/td&gt;
  
&lt;td&gt;Renders&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;GridView&lt;/td&gt;
  
&lt;td&gt;Table element with optional anchors&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;DataList&lt;/td&gt;
  
&lt;td&gt;If RepeatLayout is set to Table, then the control renders
  standard table markup
  If RepeatLayout is set to Flow, then the control renders a
  series of Label and BR elements&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;DetailsView&lt;/td&gt;
  
&lt;td&gt;Series of elements including links and table markup&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr&gt;
  
&lt;td&gt;FormView&lt;/td&gt;
  
&lt;td&gt;HTML table&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr style="background-color: rgb(255, 255, 204);"&gt;
  
&lt;td&gt;Repeater&lt;/td&gt;
  
&lt;td&gt;N/A&lt;/td&gt;
 &lt;/tr&gt;
 
&lt;tr style="background-color: rgb(255, 255, 204);"&gt;
  
&lt;td&gt;ListView&lt;/td&gt;
  
&lt;td&gt;N/A&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;h2&gt;ASP.NET SEO&lt;/h2&gt;
&lt;p&gt;Much of the talk surrounding taming HTML is often in the
context of building website to be search-engine friendly. In some arenas
ASP.NET is viewed as a sub-standard platform for creating search engine
optimized websites. While this charge is categorically false, sometimes it’s
not hard to see why some reach such an extreme conclusion.&lt;/p&gt;

&lt;p&gt;ASP.NET is no better or worse platform for building sites
optimized for search engine placement than a Java or Rails site – the problem
is often the UI developer. While Microsoft and a host of third-party organizations
work hard building tools and controls that aid in RAD development, using these
techniques in their default states, may not always be the best approach for building 
public facing websites.&lt;/p&gt;

&lt;p&gt;The bottom line is know the HTML you are generating and use
the right tool for the right job.&lt;/p&gt;

&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fweblogs.asp.net%2fcraigshoemaker%2farchive%2f2008%2f12%2f02%2fcontrolling-html-in-asp-net-webforms.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fweblogs.asp.net%2fcraigshoemaker%2farchive%2f2008%2f12%2f02%2fcontrolling-html-in-asp-net-webforms.aspx" alt="kick it on DotNetKicks.com" border="0"&gt;&lt;/a&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6762751" width="1" height="1"&gt;</description><enclosure url="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2008-12-02-controlhtml.mp3" length="18710740" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Polymorphic+Podcast/default.aspx">Polymorphic Podcast</category></item><item><title>Using jQuery to Call ASP.NET AJAX Page Methods – By Example</title><link>http://weblogs.asp.net/craigshoemaker/archive/2008/11/07/using-jquery-to-call-asp-net-ajax-page-methods-by-example.aspx</link><pubDate>Fri, 07 Nov 2008 15:20:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6725396</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=6725396</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2008/11/07/using-jquery-to-call-asp-net-ajax-page-methods-by-example.aspx#comments</comments><description>&lt;p&gt;A commenter recently requested a more in-depth sample
demonstrating the technique I used in my &lt;a href="http://weblogs.asp.net/craigshoemaker/archive/2008/09/29/using-jquery-to-call-asp-net-ajax-page-methods.aspx" mce_href="http://weblogs.asp.net/craigshoemaker/archive/2008/09/29/using-jquery-to-call-asp-net-ajax-page-methods.aspx"&gt;Using
jQuery to Call ASP.NET AJAX Page Methods&lt;/a&gt; post. He wanted to see how you
could use jQuery to send the contents of a GridView row to a WebMethod page.&lt;/p&gt;

&lt;p&gt;Here are the steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Create template columns in the GridView and wrap
the data you want to send to the server in some sort of tag that you can access
via JavaScript&lt;/li&gt;
&lt;li&gt;Create a link that calls the JavaScript function
that extracts the data and prepares it for the Ajax request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most interesting lines of code really are lines 41 – 45 of
the ASPX markup. These lines are where the script formats the variables
appropriately to use the CallPageMethod function that uses jQuery to call the page’s
WebMethod.&lt;/p&gt;

&lt;h3&gt;The ASPX Markup&lt;/h3&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="asp"&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridView.aspx.cs" Inherits="Test_GridView" %&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="html"&gt;DOCTYPE&lt;/span&gt; &lt;span class="attr"&gt;html&lt;/span&gt; &lt;span class="attr"&gt;PUBLIC&lt;/span&gt; &lt;span class="kwrd"&gt;"-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;/span&gt; &lt;span class="kwrd"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/css"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    .none {display:none;}&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;="../jquery-1.2.6.min.js"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &amp;lt;script type=&lt;span class="str"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; CallPageMethod(methodName, onSuccess, onFail) {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; args = &lt;span class="str"&gt;''&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; l = arguments.length;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (l &amp;gt; 3) {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;var&lt;/span&gt; i = 3; i &amp;lt; l - 1; i += 2) {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (args.length != 0) args += &lt;span class="str"&gt;','&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                args += &lt;span class="str"&gt;'"'&lt;/span&gt; + arguments[i] + &lt;span class="str"&gt;'":"'&lt;/span&gt; + arguments[i + 1] + &lt;span class="str"&gt;'"'&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; loc = window.location.href;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        loc = (loc.substr(loc.length - 1, 1) == &lt;span class="str"&gt;"/"&lt;/span&gt;) ? loc + &lt;span class="str"&gt;"default.aspx"&lt;/span&gt; : loc;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        $.ajax({&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            type: &lt;span class="str"&gt;"POST"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            url: loc + &lt;span class="str"&gt;"/"&lt;/span&gt; + methodName,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            data: &lt;span class="str"&gt;"{"&lt;/span&gt; + args + &lt;span class="str"&gt;"}"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;            contentType: &lt;span class="str"&gt;"application/json; charset=utf-8"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;            dataType: &lt;span class="str"&gt;"json"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;            success: onSuccess,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            fail: onFail&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        });&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; select(index) {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; id = $(&lt;span class="str"&gt;"#id"&lt;/span&gt; + index).html();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; title = $(&lt;span class="str"&gt;"#ttl"&lt;/span&gt; + index).html();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; author = $(&lt;span class="str"&gt;"#auth"&lt;/span&gt; + index).html();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; pubDate = $(&lt;span class="str"&gt;"#pubDate"&lt;/span&gt; + index).html();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        CallPageMethod(&lt;span class="str"&gt;"SelectBook"&lt;/span&gt;, success, fail,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            &lt;span class="str"&gt;"id"&lt;/span&gt;,id,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;            &lt;span class="str"&gt;"title"&lt;/span&gt;,title,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;            &lt;span class="str"&gt;"author"&lt;/span&gt;,author, &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;            &lt;span class="str"&gt;"publishDate"&lt;/span&gt;,pubDate);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; success(response)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;        alert(response.d);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; fail(response)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;        alert(&lt;span class="str"&gt;"An error occurred."&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;form&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="form1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;        &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="gv"&lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;        &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;        &lt;span class="attr"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span class="kwrd"&gt;="False"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Select"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript:void(0);"&lt;/span&gt; &lt;span class="attr"&gt;onclick&lt;/span&gt;&lt;span class="kwrd"&gt;="select(&amp;lt;%= this.index.ToString() %&amp;gt;);"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Select&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Title"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="id&amp;lt;%= this.index.ToString() %&amp;gt;"&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;="none"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Literal&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="id"&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;                        &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%# Bind("ID") %&amp;gt;'&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="ttl&amp;lt;%= this.index.ToString() %&amp;gt;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Literal&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="ttl"&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;                        &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%# Bind("Title") %&amp;gt;'&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Author"&lt;/span&gt; &lt;span class="attr"&gt;SortExpression&lt;/span&gt;&lt;span class="kwrd"&gt;="Author"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="auth&amp;lt;%= this.index.ToString() %&amp;gt;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Literal&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="author"&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;                        &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%# Bind("Author") %&amp;gt;'&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Publish Date"&lt;/span&gt; &lt;span class="attr"&gt;SortExpression&lt;/span&gt;&lt;span class="kwrd"&gt;="PublishDateShort"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="pubDate&amp;lt;%= this.index.ToString() %&amp;gt;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Literal&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="dt"&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;                        &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%# Bind("PublishDateShort") %&amp;gt;'&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;span&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;                    &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.index++; &lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  96:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;The Codebehind&lt;/h3&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Services;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Test_GridView : System.Web.UI.Page&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; index = 0;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (!&lt;span class="kwrd"&gt;this&lt;/span&gt;.Page.IsPostBack)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv.DataSource = BookRepository.Instance.GetBooks(5);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv.DataBind();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    [WebMethod]&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; SelectBook(&lt;span class="kwrd"&gt;int&lt;/span&gt; id, &lt;span class="kwrd"&gt;string&lt;/span&gt; title, &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; author, DateTime publishDate)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; msg = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"You selected \"{0}\" by {1} "&lt;/span&gt; +&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            &lt;span class="str"&gt;"published on {2}."&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            title, author, publishDate.ToShortDateString());&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; msg;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6725396" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>ASP.NET SEO</title><link>http://weblogs.asp.net/craigshoemaker/archive/2008/10/14/asp-net-seo.aspx</link><pubDate>Tue, 14 Oct 2008 15:35:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6680975</guid><dc:creator>craigshoemaker</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/craigshoemaker/rsscomments.aspx?PostID=6680975</wfw:commentRss><comments>http://weblogs.asp.net/craigshoemaker/archive/2008/10/14/asp-net-seo.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://polymorphicpodcast.com/shows/aspnetseo/"&gt;&lt;img src="http://polymorphicpodcast.com/images/ListenBanner.png" title="Listen to the Show" alt="Listen to the Show" mce_src="http://polymorphicpodcast.com/images/ListenBanner.png" width="378" border="0" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a href="http://polymorphicpodcast.com/shows/aspnetseo/"&gt;Listen to the Show!&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Michael Neel joins us today to discuss search engine optimization specifically for ASP.NET websites. Michael C. Neel is a Digital Media Developer with Jewelry
Television and independent consultant with ViNull Software. He is a board
member and Vice President of the East Tennessee .Net Users Group (ETNUG) in his
home town of Knoxville, TN. Michael has
been published in asp.netPro magazine and continues to publish .NET focused
articles on his blog (&lt;a href="http://vinull.com/"&gt;http://ViNull.com/&lt;/a&gt;) and
at Devlicio.us with other community developers. An ASPInsider, Microsoft MVP,
regular speaker at .Net conferences and user groups Michael has traveled to
most of the states surrounding Tennessee and organizes CodeStock (&lt;a href="http://codestock.org/"&gt;http://CodeStock.org/&lt;/a&gt;).&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;SEO: What Matters?&lt;/h2&gt;

&lt;p&gt;Conventional wisdom states that HTML markup must be clean,
and strict rules must be adhered to in order to have success with search
engines. Michael suggests that these positions held by SEO “experts” may not be
as accurate as some may think.&lt;/p&gt;

&lt;h3&gt;If the content is there…&lt;/h3&gt;

&lt;p&gt;Michael’s view is that if the content is found in key areas
of the page, instances of inline styles and “extra” HTML do not seem to have a
significant effect on search engine indexing.&lt;/p&gt;

&lt;h3&gt;The Drivers&lt;/h3&gt;

&lt;p&gt;The factors of a website that do drive SEO rankings are the
URL, Title, contents of the h1 tag and the text content on the page. Dividends
are awarded to consistency among the keywords among these factors. For instance
if your title and h1 match and many of the keywords are found in the URL, then
search engines will place your site at a higher favor.&lt;/p&gt;

&lt;h3&gt;Nice Guys Finish First&lt;/h3&gt;

&lt;p&gt;Meta-tags and meta-descriptions were the keys of the days of
old in search engine placement, but now due to rampant abuse, search engines
tend to lower the influence of these tags.&lt;/p&gt;

&lt;p&gt;Be careful how to craft your site. If the search engines
think you are trying to cheat the system your site may be de-valued or even
de-listed. As your site proves to the search-bots that you can be trusted, then
your site is more easily able to benefits from the SEO placement formulas.&lt;/p&gt;

&lt;h2&gt;Crafting Content&lt;/h2&gt;

&lt;p&gt;Often SEO placement is a simple function of how well you
write your content. If you write headlines and other SEO relevant elements based
off of what people search for, your site will easily gravitate to viewers. For
instance, Michael’s most popular blog post is title &lt;a href="http://www.vinull.com/Post/2006/02/15/aspnet-adding-a-total-to-gridview.aspx"&gt;Adding
a Total to a GridView&lt;/a&gt;. A post with such a succinct title is bound to get
heavier traffic than posts titled like &lt;a href="http://www.vinull.com/Post/2008/06/27/youll-have-my-sql-when-you-pry-my-keybo.aspx"&gt;You'll
have my SQL when you pry my keyboard from my cold dead hands&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;When ASP.NET is Invisible to Google&lt;/h2&gt;

&lt;p&gt;Some ASP.NET websites have suffered from invisibility to
Google. At first the cause is not apparent, but with some digging the culprit
was often bug in ASP.NET 2.0 runtime (which is resolved in .NET 3.5 SP1).&lt;/p&gt;

&lt;p&gt;When requests come in the ASP.NET pipeline, the rendering
engine will choose a text writer that is appropriate for what seems like is the
correct browser level. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.html32textwriter.aspx"&gt;HTML32TextWriter&lt;/a&gt;
class will target an HTML3 level browser – so you will never see the result of
this rendering in contemporary UI client. (Even pages viewed with the &lt;a href="http://en.wikipedia.org/wiki/Lynx_%28web_browser%29"&gt;Lynx web browser&lt;/a&gt;
receive a HTML level 4 rendering)&lt;/p&gt;

&lt;p&gt;Calling the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.httpcontext.rewritepath.aspx"&gt;HttpContext.RewritePath&lt;/a&gt;
method would throw an exception resulting in a 500 error. Virtually the only
time the site would encounter this problem was when the search engine bots
attempted to crawl and index the site since the user agent of the spider would
trigger a low-level text writer version.&lt;/p&gt;

&lt;p&gt;Note: Setup ASP.NET health monitoring to let you know when
errors happen on your site.&lt;/p&gt;

&lt;h3&gt;Is My Site at Risk?&lt;/h3&gt;

&lt;p&gt;The simple way to know is to search for your site. If your
website appears in a search result – then you are not suffering from this
problem.&lt;/p&gt;

&lt;p&gt;Since this is a problem you will never see first-hand using
modern browsers you need you will only know about the problem if you notice
your site not appearing in search engine results or you tool your website to
report all exceptions via ASP.NET health monitoring or some other exception
management solution.&lt;/p&gt;

&lt;h2&gt;What’s the Fix?&lt;/h2&gt;

&lt;p&gt;There a number of ways to shield your website against this
error:&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;Enforce Cookies to bypass
     the need for doing RewritePath&lt;/li&gt;
 
&lt;li&gt;Create &lt;a href="http://www.codeproject.com/KB/aspnet/browsercaps.aspx"&gt;Browser Files&lt;/a&gt;
     and up-version the Google bot to a higher browser version&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;SiteMaps for Better Rankings&lt;/h2&gt;

&lt;p&gt;Use ASP.NET site maps to help guide search engines to the
content in your website&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/yy2ykkab.aspx"&gt;ASP.NET Site
     Maps&lt;/a&gt;&lt;/li&gt;
 
&lt;li&gt;Exercise the Cache pattern
     in the provider: &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163657.aspx"&gt;The SQL Site
     Map Provider You've Been Waiting For&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What you want to try to avoid is creating different URLs
that result in the same content. This practice may flag the search engine that
you are trying to cheat the system.&lt;/p&gt;

&lt;p&gt;For instance a URL pointing to the services page of a site
may look like this&lt;/p&gt;

&lt;pre style="padding: 10px; background-color: rgb(238, 238, 238); font-size: 1.2em;"&gt;http://site.com/services/default.aspx?s=seo&lt;/pre&gt;

&lt;p&gt;...and also like this...&lt;/p&gt;

&lt;pre style="padding: 10px; background-color: rgb(238, 238, 238); font-size: 1.2em;"&gt;http://site.com/services/?s=seo&lt;/pre&gt;

&lt;p&gt;...but maintaining both of these URLs will reduce your SEO
potency. Building sitemaps can help you alleviate these types of problems by
keeping your URLs consistent.&lt;/p&gt;

&lt;h2&gt;Sitemap Protocol&lt;/h2&gt;

&lt;p&gt;The &lt;a href="http://sitemaps.org/"&gt;sitemap protocol&lt;/a&gt; is
an open standard method for describing and directing search engines around your
website.&lt;/p&gt;

&lt;p&gt;The protocol includes a number of meta-data elements that
give you control over how your website is indexed:&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;Location : The URL to the
     pages in your site&lt;/li&gt;
 
&lt;li&gt;Priority Weight: A
     relative priority in the context of the entire site. For example you may
     weight blog post pages a higher priority over the blog homepage in the
     event of an indexing conflict.&lt;/li&gt;
 
&lt;li&gt;Change Frequency:
     Indicates to the search engines how often to return to pages for
     re-indexing&lt;/li&gt;
 
&lt;li&gt;Lastmod: Date of last
     change &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some say that a well-structured website won’t need a site
map, but there is a lot of value in the meta-data giving site owners power over
how the crawlers will interpret the website.&lt;/p&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
 
&lt;li&gt;&lt;a href="http://www.vinull.com/Blogs/"&gt;Michael Neel’s blog&lt;/a&gt;&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://www.vinull.com/Post/2008/10/11/google-can-you-hear-me.aspx"&gt;Google
     Can You Hear Me?&lt;/a&gt;: Michael’s article originally published in ASP.NET
     Pro Magazine&lt;/li&gt;
 
&lt;li&gt;Google &lt;a href="http://www.google.com/webmasters/"&gt;Webmaster’s Central&lt;/a&gt;: See how
     Google sees your site&lt;/li&gt;
 
&lt;li&gt;Google Webmaster’s &lt;a href="http://googlewebmastercentral.blogspot.com/"&gt;blog&lt;/a&gt;: Hear directly
     from Google what helps your site perform to its potential&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://www.google.com/analytics/"&gt;Google analytics&lt;/a&gt;: See traffic
     and ad conversion statistics on your website&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://aspnet.4guysfromrolla.com/articles/031407-1.aspx"&gt;ASP.NET
     Health Monitoring&lt;/a&gt;:&lt;span style=""&gt;  &lt;/span&gt;Configure
     your site to tell you about any problems encountered&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2008/10/07/asp-net-podcast-show-125-routing-with-webforms.aspx"&gt;ASP.NET
     Routing with WebForms&lt;/a&gt;: Use the routing features to craft SEO-friendly
     URLs in WebForms&lt;/li&gt;
&lt;/ul&gt;

&lt;hr&gt;
&lt;h2&gt;Congratulations&lt;/h2&gt;

&lt;p&gt;Congratulations to our distinguished guest &lt;a href="http://vinull.com/"&gt;Michael Neel&lt;/a&gt;, &lt;a href="http://jesschadwick.com/"&gt;Jess
Chadwick&lt;/a&gt; and &lt;a href="http://www.granthinkson.com/"&gt;Grant Hinkson&lt;/a&gt; for joining
the Microsoft MVP program!&lt;/p&gt;

&lt;h2&gt;Upcoming Engagments&lt;/h2&gt;

&lt;p&gt;If you would like to catch up in person I am speaking at the
following:&lt;/p&gt;

&lt;ul&gt;
 
&lt;li&gt;&lt;a href="http://vslive.com/2008/lasvegas/webdevelopment.aspx#VLW17"&gt;VSLive!
     Las Vegas&lt;/a&gt; – 10/15/08&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://www.ladotnet.org/"&gt;LA.NET&lt;/a&gt; – 11/03/08&lt;/li&gt;
 
&lt;li&gt;&lt;a href="http://www.sandiegodotnet.com/"&gt;San Diego .NET User Group&lt;/a&gt; – 01/20/09&lt;/li&gt;
&lt;/ul&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6680975" width="1" height="1"&gt;</description><enclosure url="http://polymorphicpodcast.com/podcast/files/PolymorphicPodcast-2008-10-13-aspnetseo.mp3" length="47303620" type="audio/mpeg" /><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Podcast/default.aspx">Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/Polymorphic+Podcast/default.aspx">Polymorphic Podcast</category><category domain="http://weblogs.asp.net/craigshoemaker/archive/tags/SEO/default.aspx">SEO</category></item></channel></rss>