Enhancing strong typed views in ASP.NET MVC

I’ve added new constructs for replacing

< % Html.RenderPartial("~/Shared/LogOnUserControl.ascx", model); %>
 
with these
< % Html.RenderPartial().Shared.LogOnUserControl(model); %>
 
where model argument is strong typed of course. There are other overloads as well.

Notes:

  • due to IE7 formatting issues I am adding an extra space after < character
  • I can’t get rid of parenthesis after RenderPartial due to extension methods limitation (there are no extension properties)

For more details read my previous article Strong typing views in ASP.NET MVC. The new template is attached below.

StrongTypedViews.zip (2.60 kb)

Other related articles:

Strong typing routes in ASP.NET MVC

Leave a Reply