Enhancing strong typed views in ASP.NET MVC

by Miha Markič 22. April 2009 11:25

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



Tags:

.net 3.5 | asp.net mvc | CodeRush

Comments

10/2/2009 2:29:19 PM #

trackback

The slides and code from my “Making asp.net mvc applications strong typed” presentation

Yesterday I held a presentation (as the part of Bleeding Edge 2009 conference) on how to make ASP.NET

Zunanji viri | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Miha Markič

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Shortcuts

Add to Technorati Favorites

Social networking

Most comments

Brandon Brandon
1 comments
us United States
business cards business cards
1 comments
au Australia
BV BV
1 comments
si Slovenia
Igor Brejc Igor Brejc
1 comments
si Slovenia

Google friends

Recent Comments

Comment RSS