0

I'm trying to use the new strongly typed helpers. I've inherited the Model in my Control: Inherits="System.Web.Mvc.ViewUserControl"

but intellisense isn't exposing the model and the page isn't happy with it if I force the code in. If I do it in a standard View all is good. This is what I'm expecting to be able to do:

<%= Html.LabelFor(m => m.FirstName) %>

Can these helpers be used in Partial Views in this manner?

Lloyd

John Farrell
  • 24,673
  • 10
  • 77
  • 110
lloydphillips
  • 2,775
  • 2
  • 33
  • 58

1 Answers1

3

Yes.

All you need to do declare your partials as strongly typed to have access to the typed Model property:

Inherits="System.Web.Mvc.ViewUserControl<YourModel>"
John Farrell
  • 24,673
  • 10
  • 77
  • 110
  • Thought so, why is intelli-sense not picking up my lambda then when I try m => m.FirstName? I try to type m and it completes it with mbox. Do you think it's installed v2 incorrectly or is there no intellisense support yet? – lloydphillips Jan 29 '10 at 22:43