Wednesday, January 26, 2011

Using Razor views with Webforms master page

While the new Razor view enginge for ASP.NET MVC3 looks fantastic, I haven't been able to dive into it quite yet. I soon discovered that you cannot mix and match Razor views with your old Webforms master page. You could have two master pages, but ideally you don't want to write the same code and markup twice.

Scott Hanselman presents a solution. "Can I mix Razor Views and WebForms Views in a single ASP.NET MVC application?", he asks. The answer is, "No, Yes, and Maybe, But It's Not Supported."

Anyways, the solutions is found on his blog.

In order to get the page title to work properly, I've done the following:

In the Controller:

ViewBag._Title = "Admin";


In the RazorView.aspx:
<%
if (ViewBag._Title != null)
Page.Title = ViewBag._Title;
%>

Saturday, January 08, 2011

jQuery.appendTemplate v 1.2.1

A minor release with updated demo example and minified javascript included is now released. Read more on the jQuery plugin website or check out the appendTemplate tag on this blog.