<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris van de Steeg &#187; Ajax</title>
	<atom:link href="http://www.chrisvandesteeg.nl/category/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisvandesteeg.nl</link>
	<description>What&#039;s practical is logical</description>
	<lastBuildDate>Fri, 03 Feb 2012 06:58:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>jQuery ajax with asp.net mvc preview 5</title>
		<link>http://www.chrisvandesteeg.nl/2008/09/16/jquery-ajax-with-aspnet-mvc-preview-5/</link>
		<comments>http://www.chrisvandesteeg.nl/2008/09/16/jquery-ajax-with-aspnet-mvc-preview-5/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 18:48:57 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.chrisvandesteeg.nl/?p=64</guid>
		<description><![CDATA[Quite some had changed between mvc p4 and mvc p5, so it took some time too update my jquery4mvc project to preview 5. Be sure to check out scott&#8217;s post to read all the new stuff. He&#8217;ll be posting on the ajaxhelpers some time soon also.&#160; If you wish to skip the reading and directly [...]]]></description>
			<content:encoded><![CDATA[<p>Quite some had changed between mvc p4 and mvc p5, so it took some time too update my jquery4mvc project to preview 5. Be sure to check out <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx">scott&#8217;s post</a> to read all the new stuff. He&#8217;ll be posting on the ajaxhelpers some time soon also.&#160; If you wish to skip the reading and directly download the stuff: it&#8217;s at <a href="http://www.codeplex.com/jquery4mvc/Release/ProjectReleases.aspx?ReleaseId=17401">codeplex</a>. </p>
<p>The javascript-only package includes 3 javascript files that allow you to use the default Microsoft AjaxHelper. You can just copy those files to your Content folder and include them in your head section, instead of the MicrosoftAjax.js and MicrosoftMvcAjax.js. All ajax extensions work the same as their Microsoft equivalence,&#160; using jQuery instead of MicrosoftAjax. As a little bonus, you&#8217;ll get back and forward button support for your ajax-links.</p>
<p><a href="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/09/image.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="92" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/09/image-thumb.png" width="644" border="0" /></a> </p>
<p>That&#8217;s it, go ahead and use the AjaxHelper functions like you&#8217;re used to. Though a few things have changed for the AjaxHelpers in preview 5, you could still use the introduction <a href="http://www.hanselman.com/blog/ASPNETMVCPreview4UsingAjaxAndAjaxForm.aspx">ASP.NET MVC Preview 4 &#8211; Using Ajax and Ajax.Form</a> by Scott Hanselman if you haven&#8217;t already checked out the AjaxHelper. Main thing that has changed is that you cannot use inline javascript in the AjaxOptions in preview 5, you should now specify a method name. You could also download the entire jQueryMvc project, it holds a sample website showing some of the ajax magic.</p>
<p>Talking about the entire project, it&#8217;s more than just the .js files! The intention of the project is to get you up and running very quickly when you want to create an mvc based ajax application. We use <a href="http://codeplex.com/unity">Unity</a> as our default IoC container.</p>
<p>I think it&#8217;s quite hard to explain exactly what the project does for you, it&#8217;s best really to just look at the sample website, but I will give a brief overview. First, we have a DefaultViewViewEngine. If you mark your controller with a [DefaultView] attribute like so:</p>
<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="55" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/09/image1.png" width="406" border="0" /> </p>
<p>If you call in example /Home/Index, by default the Index view will be searched for. If it isn&#8217;t found, the DefaultViewViewEngine will look for a template with the name specified (&quot;default&quot; in the above example). It doesn&#8217;t matter what viewengine you use for your views, it will work for all of them. So what can this do? Look at the structure of the views in the sample site:</p>
<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="261" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/09/image2.png" width="189" border="0" /> </p>
<p>As you can see, most of the the views only have an ascx file prefixed with an underscore. Since the views are not found when the actions Home/About, Home/SayHello, Home/Index are called upon, the DefaultViewViewEngine will open Shared/Default.aspx.    <br />This default page does not do much<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="76" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/09/image3.png" width="879" border="0" /> </p>
<p>As you can see, it just uses the masterpage. But with only little imagination, you can see that you can easily create different default-pages for each controller. The masterpage however, does hold some extra magic:</p>
<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="55" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/09/image4.png" width="506" border="0" /></p>
<p>This special contentplaceholder, by default works like a normal placeholder. But, if it doesn&#8217;t get new content from it&#8217;s page, it will ask the ViewEngine(s) to open the view of the current action prefixed with an underscore. So, if you call Home/About, this will ask for Home/_About.&#160; <br />Can you see the magic? For all similar pages, you just have to create the ascx files (or other partials if you use a different viewengine). Those partial views will be pushed into the main page.</p>
<p>But wait, there&#8217;s more! If you make an ajax-request to a controller that has the [AjaxController] attribute, it will return only the partial view! Now, isn&#8217;t that great ? That looks a lot like the updatepanel to me <img src='http://www.chrisvandesteeg.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.codeplex.com/jquery4mvc/Release/ProjectReleases.aspx?ReleaseId=17401">Go to codeplex and download the project to see the ajax-magic I&#8217;m so excited about!</a>    <br />Source can be downloaded at Google code: <a href="http://code.google.com/p/jquerymvc/source/checkout">http://code.google.com/p/jquerymvc/source/checkout</a>    <br />The sample website can be seen in action at: <a title="http://www.chrisvandesteeg.nl/demo/jquerymvc5/" href="http://www.chrisvandesteeg.nl/demo/jquerymvc5/">http://www.chrisvandesteeg.nl/demo/jquerymvc5/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2008/09/16/jquery-ajax-with-aspnet-mvc-preview-5/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Howto use jQuery with asp.net mvc preview 4&#8242;s AjaxHelper</title>
		<link>http://www.chrisvandesteeg.nl/2008/07/21/howto-use-jquery-with-aspnet-mvc-preview-4s-ajaxhelper/</link>
		<comments>http://www.chrisvandesteeg.nl/2008/07/21/howto-use-jquery-with-aspnet-mvc-preview-4s-ajaxhelper/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 20:56:11 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.chrisvandesteeg.nl/2008/07/21/howto-use-jquery-with-aspnet-mvc-preview-4s-ajaxhelper/</guid>
		<description><![CDATA[Working on jQuery4mvc preview 4, one of the first things I ofcourse wanted to do was to replace the ASP.NET Ajax library that&#8217;s used by the AjaxHelper. Unfortunately the AjaxHelper itself is sealed, so atm we can&#8217;t (easily) change how the AjaxHelper generates its links. So, as an alternative, I created a javascript library that [...]]]></description>
			<content:encoded><![CDATA[<p>Working on jQuery4mvc preview 4, one of the first things I ofcourse wanted to do was to replace the ASP.NET Ajax library that&#8217;s used by the AjaxHelper.</p>
<p>Unfortunately the AjaxHelper itself is sealed, so atm we can&#8217;t (easily) change how the AjaxHelper generates its links. So, as an alternative, I created a javascript library that uses the same methodnames as the MicrosoftMvcAjax version.</p>
<p>Though at first I was upset that AjaxHelper wasn&#8217;t opened up, this javascript-only solution makes it very easy to use. All you have to do is </p>
<ul>
<li>place the <a href="http://jquery.com/">latest jQuery version</a> in your Content folder; </li>
<li>place <a href="http://www.codeplex.com/jquery4mvc/Release/ProjectReleases.aspx?ReleaseId=15521">my javascript file</a> in your Content folder; </li>
<li>add references in your views (or masterpage ofcourse) to these 2 files instead of referencing the MicrosoftMvcAjax.js and MicrosoftAjax.js file.</li>
</ul>
<p>If you haven&#8217;t played with the AjaxHelper yet, take a look at <a href="http://www.hanselman.com/blog/ASPNETMVCPreview4UsingAjaxAndAjaxForm.aspx">Scott Hanselman&#8217;s post on Using Ajax and Ajax.Form</a></p>
<p>This jQuery version also has a little extra: browser-history support for your ajax requests</p>
<p>Now, go <a href="http://www.codeplex.com/jquery4mvc/Release/ProjectReleases.aspx?ReleaseId=15521">download</a> the js file and play!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2008/07/21/howto-use-jquery-with-aspnet-mvc-preview-4s-ajaxhelper/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>jQuery for Asp.net MVC preview 3</title>
		<link>http://www.chrisvandesteeg.nl/2008/06/13/jquery-for-aspnet-mvc-preview-3/</link>
		<comments>http://www.chrisvandesteeg.nl/2008/06/13/jquery-for-aspnet-mvc-preview-3/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 13:13:08 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.chrisvandesteeg.nl/2008/06/13/jquery-for-aspnet-mvc-preview-3/</guid>
		<description><![CDATA[So, I finally got a chance to sit down and finish up the jQuery for Asp.net Mvc preview 3. If you haven&#8217;t already read Scott&#8217;s post about preview 3,&#160; you should definitely do so before reading this one. So, quite some things have changed in preview 3, which made me decide to change a lot [...]]]></description>
			<content:encoded><![CDATA[<p>So, I finally got a chance to sit down and finish up the jQuery for Asp.net Mvc preview 3. If you haven&#8217;t already read <a href="http://weblogs.asp.net/scottgu/archive/2008/05/27/asp-net-mvc-preview-3-release.aspx">Scott&#8217;s post about preview 3</a>,&#160; you should definitely do so before reading this one.</p>
<p>So, quite some things have changed in preview 3, which made me decide to change a lot in the jQuery for Asp.net mvc (<em>jqmvc</em>) too. To start with most radical one: I ditched the ajax.master. This little &#8216;framework&#8217; does not rely on a special masterpage in your website from now on. Since things have radically changed, I&#8217;ll start all over again on how to use this project. </p>
<p>In this post, I&#8217;ll explain how the project works globally. I won&#8217;t go into too much details about everything, but I will just explain the things you&#8217;ll directly touch in your application. In the next post, I&#8217;ll explain how to <em>use</em> the project in your website (until that time you could take a look at the included sample website). That post will explain the Ajax- and HtmlHelpers in this project and it will explain how to do an ajax request using jQuery.</p>
<p>Before my story starts, let&#8217;s start with the links and downloads for all those who want to read code rather than stories :</p>
<ul>
<li><a href="http://www.codeplex.com/jquery4mvc/Release/ProjectReleases.aspx?ReleaseId=14383">Downloads</a>&#160;</li>
<li><a href="http://code.google.com/p/jquerymvc/source/checkout">SVN source Repository</a></li>
<li><a href="http://code.google.com/p/jquerymvc/downloads/detail?name=preview%203%20bin.zip&amp;can=2&amp;q="></a><a href="http://www.chrisvandesteeg.nl/demo/jquerymvc3/default.aspx">The online demo</a> </li>
<li><a href="http://www.codeplex.com/jquery4mvc/">Codeplex homepage</a></li>
</ul>
<h2>Application and routes</h2>
<p>To have a quick go for your application, it&#8217;s recommended that you inherit your application from JqueryMvc.JqueryMvcApplication. You can ofcourse easily do this in your global.asax like so:    <br /><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="22" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/06/image3.png" width="531" border="0" />     <br />This application sets up the Unity dependency container and will set up the default routes. If you wish to setup a different (or no) dependency container, you should override InitializeContainer() and ConfigureContainer(). JQueryMvc itself is no longer dependent on a dependency container.</p>
<p>I found it hard to set up the default routes in preview 3 if your server does not support wildcard redirects (like visual studio&#8217;s webdevserver doesn&#8217;t). In that case you need to catch existing files (default.aspx needs to exist, but shouldn&#8217;t do anything), but you need to skip the Content folder. I came up with the following solution:    <br /><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="648" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/06/image6.png" width="536" border="0" />     <br />So if there&#8217;s a default.aspx in the root of your application, it set&#8217;s routeExistingFiles to true. If the url matches the RegEx ^Content\/.* the routing will be stopped using the new IgnoreRoute method. Also, your controllers will then be extended with .aspx to be sure the requests passes the asp.net cycle. If you have the option to catch all incoming requests, all you have to do is remove the default.aspx from the root of your website.</p>
<h1></h1>
<h2>Controllers</h2>
<p>As you&#8217;ve seen in Scott&#8217;s post, controllers should now return an ActionResult. The normal way would be to have your controller action return the result of the View() method. With <em>jqmvc</em> you should not call the View() method at the end of your action. Ofcourse, if you&#8217;re sure you want to return the normal view, you could still do so. In <em>jqmvc</em> there is a ExtController which you should inherit your controllers from. This baseclass contains a method called Action() which accepts the same attributes as View() but does some magic to decide what type of request the current request is, and will try to return the correct ActionResult for that type of request. This could be either an Ajax-request, a Json request or a normal page-request. Your typical controller with some actions would look like this:</p>
<p>&#160;&#160; <img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="399" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/06/image7.png" width="537" border="0" /></p>
<h2>Views</h2>
<p>If <em>jqmvc</em> encountered the current request as a normal page request, it will create the default ViewResult, nothing special there.</p>
<p>If <em>jqmvc </em>decided Json should be returned, a JsonResult is created and no further actions will be taken. The rendered view will be the ViewData serialized to Json. The ViewEngine of the controller is also changed to a JsonViewEngine but this is only called upon in case of an Exception.</p>
<p>If <em>jqmvc</em> decided that the request is an Ajax request, it will create a normal ViewResult, but it will change the ViewLocator of the controller.     <br />(Offtopic: I think it&#8217;s a design-error to have the viewlocator on the controller. It should be on the ViewResult object, that&#8217;s the only object that uses it. Perhaps this will be changed in the next preview&#8230;)     <br />This AjaxViewLocator will first look for .ascx files instead of .aspx files. If it can&#8217;t find the .ascx it will load .aspx afterall.&#160; You can also create a target-specific .ascx file: if you do an ajax-request through our javascript function jQuery.mvc.request() (or one of the htmlhelper functions), you have to specify a target for the loaded content. Let&#8217;s say we want to load /Home/Index into a &lt;div id=&quot;dynamiccontent&quot;&gt;&lt;/div&gt;     <br />The AjaxViewLocator will then look for :</p>
<ol>
<li>/Views/Home/Index.dynamiccontent.ascx </li>
<li>/Views/Home/Index.acx </li>
<li>/Views/Home/dynamiccontent.ascx </li>
<li>/Views/Home/Index.aspx </li>
<li>/Views/Shared/Index.dynamiccontent.ascx </li>
<li>/Views/Shared/Index.ascx </li>
<li>/Views/Shared/dynamiccontent.ascx </li>
<li>/Views/Shared/Index.aspx </li>
</ol>
<p>To have the page /Home/index available both as an ajax request as well as normal request, you could create an /Views/Home/Index.aspx which loads the index.ascx like so:<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="25" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/06/image1.png" width="454" border="0" /> </p>
<h2>Things to know</h2>
<h4></h4>
<ul>
<li>
<p>We have some HelperClasses to simplify the use of <em>jqmvc</em></p>
</li>
<li>
<p>The ViewData keys &quot;Messages&quot; and &quot;Errors&quot; are treated specially by <em>jqmvc.</em> </p>
</li>
<li>
<p>Your page should always contain:</p>
<ul>
<li>
<p>&lt;%= Html.RegisterJqueryMvc(Page.ClientScript) %&gt; To register the required javascript files</p>
</li>
<li>
<p>&lt;div id=&quot;loading&quot;&gt;&lt;/div&gt;; or something else with id=&quot;loading&quot;. This will be made visible during ajax-requests</p>
</li>
<li>
<p>&lt;div id=&quot;errors&quot;&gt;&lt;/div&gt; to display errors</p>
</li>
<li>
<p>&lt;div id=&quot;messages&quot;&gt;&lt;/div&gt; to display messages (informational)</p>
</li>
</ul>
</li>
<li>
<p>We have a special contentplaceholder in JqueryMvc.UI.WebControls.ContentPlaceHolder. This will use the AjaxViewLocator to load some default content. Eg, if used like this in your masterpage, and the current request is /Home/Index:        <br />&lt;jq:ContentPlaceHolder ID=&quot;maincontent&quot; runat=&quot;server&quot; /&gt;         <br />It will look for for content in:</p>
<ol>       </ol>
<ol>
<li>/Views/Home/Index.maincontent.ascx </li>
<li>/Views/Home/Index.acx </li>
<li>/Views/Home/maincontent.ascx </li>
<li>/Views/Home/Index.aspx </li>
<li>/Views/Shared/Index.maincontent.ascx </li>
<li>/Views/Shared/Index.ascx </li>
<li>/Views/Shared/maincontent.ascx </li>
<li>/Views/Shared/Index.aspx
<p>This way, your index.aspx could just be an empty page that points to MasterPage with this default-content-loading contentplaceholer.<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="27" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/06/image2.png" width="454" border="0" /> </li>
</ol>
</li>
<li>Your ascx files should inherit from JqueryMvc.Mvc.ExtViewUserControl to have access to the AjaxHelper (bug in asp.net mvc!) and to have the messages &amp; errors parsed by <em>jqmvc</em>. </li>
<li>In case of an error the default controller will look for a rescue page in /Views/[ControllerName]/Rescues/error.aspx or /Views/Shared/Rescues/error.aspx (or .ascx in case of an ajax request). You can specify your own rescues for different types of errors by using the RescueAttribute of </li>
<li>You should remove default.aspx if your application-server supports wildcard mappings. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2008/06/13/jquery-for-aspnet-mvc-preview-3/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>jQuery for ASP.NET MVC preview 2</title>
		<link>http://www.chrisvandesteeg.nl/2008/03/26/jquery-for-aspnet-mvc-preview-2/</link>
		<comments>http://www.chrisvandesteeg.nl/2008/03/26/jquery-for-aspnet-mvc-preview-2/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 19:37:22 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.chrisvandesteeg.nl/2008/03/26/jquery-for-aspnet-mvc-preview-2/</guid>
		<description><![CDATA[I updated the jQueryMvc project so that it works with ASP.NET MVC preview 2. I also switched the IoC container from Objectbuilder to Unity. I submitted the Unity container to the MvcContrib project but it has not yet been accepted in their repository, so you&#8217;ll have to do with the unofficial version I include in [...]]]></description>
			<content:encoded><![CDATA[<p>I updated the jQueryMvc project so that it works with <a href="http://www.google.nl/url?sa=t&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fwww.microsoft.com%2Fdownloads%2Fdetails.aspx%3FFamilyID%3D38cc4cf1-773a-47e1-8125-ba3369bf54a3&amp;ei=t57qR77FIJacxAHfgu31Cg&amp;usg=AFQjCNH5Y3w0Qt8KMrr3vLRHHQH1GwEJpQ&amp;sig2=_BtORUlMGY88ZK2Qqjz46g">ASP.NET MVC preview 2</a>. I also switched the IoC container from Objectbuilder to <a href="http://www.codeplex.com/unity">Unity</a>. I submitted the Unity container to the <a href="http://www.mvccontrib.org">MvcContrib</a> project but it has not yet been accepted in their repository, so you&#8217;ll have to do with the unofficial version I include in the download. Unity is, to put it very baldly, Objectbuilder version 2. So it seemed logical to make the switch.</p>
<p>I also made up a nice(r) way to inject the ViewEngine into the BaseController. It&#8217;s now injected through a public method using a MethodInjection attribute:</p>
<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="137" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/03/image.png" width="450" border="0"/></p>
<p>Thanks to this method, we no longer have pre-register all the Controllers with our container (in the previous version of jQueryMvc I scanned all dll&#8217;s on ApplicationStart to register the Controller and assign the ServiceViewFactory as the default ViewFactory)</p>
<p>Furthermore, since the ASP.NET MVC team decided to change the way the Views are rendered (now through a ViewEngine, which is nice I think), it was no longer needed to use the code from <a href="http://www.aaronlerch.com/blog/2008/01/01/unifying-web-sites-and-web-services-with-the-aspnet-mvc-framework/">Aaron Lerch</a>. Though still inspired by his code ofcourse, I removed almost all of his code now. We now have a single &#8216;<a href="http://jquerymvc.googlecode.com/svn/trunk/jQueryMvc/ServiceViewEngine.cs">ServiceViewEngine</a>&#8216; inheriting from the ASP.NET MVC&#8217;s default WebFormViewEngine. All code deciding what view to render, is now located in this class.</p>
<p>What I did not like about preview 2, is that the name of the master-template cannot be set from within the ViewEngine. It&#8217;s now stored into the ViewContext, and the setter is private <img src='http://www.chrisvandesteeg.nl/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> . So now the mastertemplate is set in the BaseController, causing the BaseController to have to know what type of request the current one is (which is bad):</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="191" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/03/image1.png" width="577" border="0"/> </p>
<p>As usual, you can download the hottest source from the Subversion repository at <a title="http://code.google.com/p/jquerymvc/source/checkout" href="http://code.google.com/p/jquerymvc/source/checkout">http://code.google.com/p/jquerymvc/source/checkout</a> or you can <a href="/download/jquerymvc/jquerymvc-0.3.zip">download a zipped package of the source code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2008/03/26/jquery-for-aspnet-mvc-preview-2/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>jQuery for ASP.NET Mvc &#8211; part 2</title>
		<link>http://www.chrisvandesteeg.nl/2008/02/16/jquery-for-aspnet-mvc-part-2/</link>
		<comments>http://www.chrisvandesteeg.nl/2008/02/16/jquery-for-aspnet-mvc-part-2/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 20:35:59 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrisvandesteeg.nl/2008/02/16/jquery-for-aspnet-mvc-part-2/</guid>
		<description><![CDATA[[go to downloads] A view days after I created my sample project that added some jQuery magic to the ASP.NET Mvc Framework, Aaron Lerch wrote an interesting article. He used a ViewFactory to do the json-serialization and added XML serialization as well. I liked this approach better then using masterpages. I took his code, altered [...]]]></description>
			<content:encoded><![CDATA[<p><a href="#downloads">[go to downloads]</a></p>
<p>A view days after I created my sample project that added some jQuery magic to the ASP.NET Mvc Framework, <a href="http://www.aaronlerch.com/">Aaron Lerch</a> wrote an <a href="http://www.aaronlerch.com/blog/2008/01/01/unifying-web-sites-and-web-services-with-the-aspnet-mvc-framework/">interesting article</a>.</p>
<p>He used a ViewFactory to do the json-serialization and added XML serialization as well. I liked this approach better then using masterpages. I took his code, altered some bits and created a library called jQueryMvc with it. This library also utilizes the <a href="http://www.codeplex.com/MVCContrib">MvcContrib</a> project. It&#8217;s now even easier to make your ASP.NET Mvc project ajax-enabled with jQuery, it just requires 4 steps:</p>
<ol>
<li>Add a reference to jQueryMvc.dll </li>
<li>Make your global.asax inherit from JqueryMvcApplication </li>
<li>Add &lt;%= Ajax.RegisterJqueryMvc(Page.ClientScript) %&gt; to the &lt;head&gt; section of your (master)pages. </li>
<li>Let your controllers inherit from BaseController </li>
</ol>
<p>That&#8217;s it, your all set. You should take a look at the SampleSite that&#8217;s included in the download on how to use the utility. Using it works almost the same as the previous version, so if you haven&#8217;t done so, you should read my <a href="http://www.chrisvandesteeg.nl/2007/12/19/ajax-and-json-for-aspnet-mvc-with-jquery/">previous article</a>. The only difference is the exception handling. Since I decided to embrace the MvcContrib project, the exception handling for ajax &amp; html requests have changed. Exceptions are now handled with a [Rescue] attribute. The BaseController has a default Rescue attribute attached which leads all exceptions to the &quot;error.aspx&quot; rescue handler. So your project should at least have /Views/Shared/Rescues/error.aspx that outputs the exceptions for your site. If you want to catch specific exception for yourself, you can add a rescue attribute to your site that catches that error type. E.g. if you want to catch a SecurityException, you could add<a href="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/02/image.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="44" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/02/image-thumb.png" width="509" border="0" /></a> </p>
<p>If an exception of type SecurityException is thrown during a controller action execution in your HomeController, MvcContrib will look for /Views/Home/Rescues/security.aspx and if that doesn&#8217;t exist, it will look for /Views/Shared/Rescues/security.aspx. The viewdata for those pages will be the exception itself. The rescue attribute can also be used on method level.</p>
<p>Another nice thing is that the MvcContrib is build to use Inversion of Control (IoC). <strong>BUT!</strong>: if you don&#8217;t want to do anything with IoC for now, you can leave it where it is! jQueryMvc just uses it for attaching the ViewFactory to your controllers, that&#8217;s all you need to know. You can also stop reading just here, the rest is about the dependency container that I used.</p>
<p>For jQueryMvc I choose the <a href="http://www.codeplex.com/ObjectBuilder">Microsoft Objectbuilder</a> framework for this, although, with MvcContrib, you&#8217;re free to choose an other framework. I choose the ObjectBuilder, since I&#8217;m the one that committed that to MvcContrib <img src='http://www.chrisvandesteeg.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>In JqueryMvcApplication, when the application get&#8217;s initialized, we&#8217;re looking for all controllers in the currently running project. <a href="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/02/image1.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="292" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/02/image-thumb1.png" width="756" border="0" /></a></p>
<p>All these controllers are registered with the Dependency container and our custom ViewFactory is also registered with this container. The ObjectBulderControllerFactory makes sure the controllers are fetched through that very container, and when that happens, the ViewFactory is attached to them.</p>
<p><a href="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/02/image2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="108" alt="image" src="http://www.chrisvandesteeg.nl/wp-content/uploads/2008/02/image-thumb2.png" width="723" border="0" /></a></p>
<p>There are also some&#160; nice helper functions in JqueryMvcApplication, for making the registration of your own services/helpers/etc into the container a breeze.</p>
<p>I&#8217;ll talk about using the container in some other article sometime.</p>
<p>For now, have fun with jQueryMvc.</p>
<p> <a name="downloads"></a>
<p><strong>Downloads</strong></p>
<ul>
<li><a href="http://code.google.com/p/jquerymvc/">Project at GoogleCode</a> </li>
<li><a href="/download/jquerymvc/jquerymvc2.zip">Download source, binaries &amp; sample project</a> </li>
<li><a href="/demo/jquerymvc2/">View online demo of the sample site</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2008/02/16/jquery-for-aspnet-mvc-part-2/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Livegrid 1.6 bugfix release</title>
		<link>http://www.chrisvandesteeg.nl/2006/09/15/livegrid-16-bugfix-release/</link>
		<comments>http://www.chrisvandesteeg.nl/2006/09/15/livegrid-16-bugfix-release/#comments</comments>
		<pubDate>Fri, 15 Sep 2006 09:02:04 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[LiveGrid]]></category>

		<guid isPermaLink="false">http://blog.ilikeu2.nl/2006/09/15/livegrid-16-bugfix-release/</guid>
		<description><![CDATA[Version 1.6 of the livegrid is available for download. This fixes an issue with get MaxFetchSize (thanks to Duane Fields for reporting this issue)]]></description>
			<content:encoded><![CDATA[<p>Version 1.6 of the livegrid is <a href="/demo/livegrid.js">available for download</a>. This fixes an issue with get MaxFetchSize (thanks to Duane Fields for reporting this issue)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2006/09/15/livegrid-16-bugfix-release/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>New version of livegrid.js</title>
		<link>http://www.chrisvandesteeg.nl/2006/06/05/new-version-of-livegridjs/</link>
		<comments>http://www.chrisvandesteeg.nl/2006/06/05/new-version-of-livegridjs/#comments</comments>
		<pubDate>Mon, 05 Jun 2006 09:50:20 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[LiveGrid]]></category>

		<guid isPermaLink="false">http://blog.ilikeu2.nl/2006/06/05/new-version-of-livegridjs/</guid>
		<description><![CDATA[So, finally have an internet connection on my new address. First thing to do is hand you over the new version of livegrid.js. This is a bugfix release only, no new features are introduced. Download here]]></description>
			<content:encoded><![CDATA[<p>So, finally have an internet connection on my new address. First thing to do is hand you over the new version of livegrid.js.</p>
<p>This is a bugfix release only, no new features are introduced.</p>
<p><a href="/demo/livegrid.js">Download here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2006/06/05/new-version-of-livegridjs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Perry project approved</title>
		<link>http://www.chrisvandesteeg.nl/2005/10/13/perry-project-approved/</link>
		<comments>http://www.chrisvandesteeg.nl/2005/10/13/perry-project-approved/#comments</comments>
		<pubDate>Thu, 13 Oct 2005 06:36:12 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Perry]]></category>

		<guid isPermaLink="false">http://blog.ilikeu2.nl/?p=10</guid>
		<description><![CDATA[Today, my project at tigris.org got approved! I first tried at sourceforge.net, but imho they always dissaprove projects and then you have to contact them by adding a support ticket :s &#8230; Well, tigris.org is better anyway Anyway, this is a nice moment to let you guys know what I&#8217;m working on atm. I&#8217;m currently [...]]]></description>
			<content:encoded><![CDATA[<p>Today, <a href="http://perry.tigris.org/">my project at tigris.org</a> got approved! I first tried at sourceforge.net, but imho they always dissaprove projects and then you have to contact them by adding a support ticket :s &#8230;<br />
Well, tigris.org is better anyway <img src='http://www.chrisvandesteeg.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Anyway, this is a nice moment to let you guys know what I&#8217;m working on atm. I&#8217;m currently busy with the API-provider of the project, and it&#8217;s coming along quite nicely. There&#8217;s no need to check out the code from tigris yet, it&#8217;s really useless in the current state! I&#8217;ll ofcourse let you know when 0.1 alpha version is ready!</p>
<p>The project description:</p>
<h3>Mission</h3>
<p>
The mission of Perry is to create a backwards compatible &#8216;web 2.0&#8242; framework, utilizing the PEAR repository as much as possible.<br />
Perry will provide you with a MVC framework for PHP with all modern &#8216;web 2.0&#8242; features build on-the-fly &#8482;.<br />
The model part is handled with the DB_DataObject library,<br />
the views are XSLT and the controller is perry itself.</p>
<p>All public functions of your application will be made available to other developers through a wide set of API&#8217;s.<br />
Currently the developers can choose between SOAP, REST, XML-RPC, JSON, HTML (partly or entire page). </p>
<p>If the client doesnt support javascript (or to be more specific: xmlhttprequests), we&#8217;ll fall back to plain HTML output.<br />
No extra work required! Everyone can view (or crawl!!) your site, it&#8217;s just that without the jscript the user will<br />
have to deal with some less functionalities, but the content will be available. </p>
<p>Although inspired a little by <a href="http://www.rubyonrails.com/">Ruby on Rails</a>, it won&#8217;t look like it by far.<br />
Perry stands all by itself, it&#8217;s PEAR on rails <img src='http://www.chrisvandesteeg.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</p>
<h3>What is the scope of this project?</h3>
<ul>
<li><a href="http://en.wikipedia.org/wiki/KISS_Principle" target="_blank">KiSS</a></li>
<li>Build a web 2.0 framework</li>
<li>Keep a small and simple base to work with. No predefined applications, just a framework</li>
<li><a href="http://pear.php.net">PEAR</a>alize!</li>
</ul>
<h3>Current features</h3>
<ul>
<li>No-extra-work-required-api accessible through SOAP, REST, XML-RPC, JSON and HTML.</li>
<li>XSLT templating.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2005/10/13/perry-project-approved/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ProtoType LiveGrid now comes with XSLT</title>
		<link>http://www.chrisvandesteeg.nl/2005/09/10/livegrid-now-comes-with-xslt/</link>
		<comments>http://www.chrisvandesteeg.nl/2005/09/10/livegrid-now-comes-with-xslt/#comments</comments>
		<pubDate>Sat, 10 Sep 2005 18:33:32 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[LiveGrid]]></category>

		<guid isPermaLink="false">http://blog.ilikeu2.nl/?p=9</guid>
		<description><![CDATA[I just finished up the newest release of my RicoLiveGrid fork&#8230; Probably this will be the last version I can build with Rico&#8217;s code, since there are to many differences with their version now. (Unless they follow my code, wich I encourage of course!). So what&#8217;s all the difference then&#8230;. Superb scroll feeling&#8230; it looks [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished up the newest release of my RicoLiveGrid fork&#8230;<br />
Probably this will be the last version I can build with Rico&#8217;s code, since there are to many differences with their version now. (Unless they follow my code, wich I encourage of course!).</p>
<p>So what&#8217;s all the difference then&#8230;.</p>
<ul>
<li>Superb scroll feeling&#8230; it looks just real <img src='http://www.chrisvandesteeg.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
<li>We can still produce any HTML, in stead of fixed table-rows</li>
<li>We now have XSLT support!!! I&#8217;m really happy with this one. It allows to have<br />
<b>any xml source</b> as dataset for the grid. Just before it gets placed into the grid for viewing, you can do some xslt magic on it. Just have a look at the source of the <a href="/demo/yahoo.html">yahoo demo</a> to see how it works. This demo will take the literal html of the yahoo-api and gets parsed by <a href="/demo/yahoo.xsl">our own xslt</a>.</li>
<li>Auto-size. the livegrid can automatically do calculations and resizing if the grid is empty on forehand. This way your HTML page doesn&#8217;t need to know the exact row-size that will be returned by the </li>
<li>In stead of keeping a set of rows in the buffer, we keep the xml-source in the buffer, and any newly loaded source is merged with the first one. For merging that is not-standard, you can specify an xpath to select the rows that should be buffered &#038; used for display.</li>
<li>And ofcourse, last but not least, the reason why I started the fork in the first place: the scrollwheel support!</li>
</ul>
<p>The sources, demo&#8217;s etc can be found at:</p>
<ul>
<li><a href="/demo/livegrid.js">The grid&#8217;s javascript</a></li>
<li><a href="/demo/demo.html">The most basic demo, loads html through ajax</a></li>
<li><a href="/demo/getrows.php.txt">The serverside script that delivers the HTML for the simple demo</a></li>
<li><a href="/demo/yahoo.html">The yahoo demo!</a></li>
<li><a href="/demo/yahoo.xsl">The yahoo xslt</a></li>
<li><a href="http://prototype.conio.net/">the prototype script that is required</a></li>
</ul>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2005/09/10/livegrid-now-comes-with-xslt/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Rico improved the grid</title>
		<link>http://www.chrisvandesteeg.nl/2005/08/19/rico-improved-the-grid/</link>
		<comments>http://www.chrisvandesteeg.nl/2005/08/19/rico-improved-the-grid/#comments</comments>
		<pubDate>Fri, 19 Aug 2005 07:16:48 +0000</pubDate>
		<dc:creator>Chris van de Steeg</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[LiveGrid]]></category>

		<guid isPermaLink="false">http://blog.ilikeu2.nl/2005/08/19/rico-improved-the-grid/</guid>
		<description><![CDATA[Just took a look at the improved rico grid (the one I used as a base for the livegrid). It indeed looks better if you show empty rows while the grid is loading&#8230; I will be adding this to the livegrid somewhere in the near future&#8230;.]]></description>
			<content:encoded><![CDATA[<p>Just took a look at the improved <a href="http://openrico.org/rico/livegrid.page">rico grid</a> (the one I used as a base for the livegrid).<br />
It indeed looks better if you show empty rows while the grid is loading&#8230; I will be adding this to the livegrid somewhere in the near future&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisvandesteeg.nl/2005/08/19/rico-improved-the-grid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

