It seems to me that you have an untyped view. By default, Razor views in MVC3 RC are typed as dynamic
. However, lambdas do not support dynamic members. You have to strongly type your model. At the top of your view file add
@model SampleModel
A common error that is the cause of this is when you add
@Model SampleModel
at the top of the page instead of
@model SampleModel
In this link explain about @model, see a excerpt:
@model
(lowercase "m") is a reserved keyword in Razor views to declare the model type at the top of your view. You have put the namespace too, e.g.:@model MyNamespace.Models.MyModel
Later in the file, you can reference the attribute you want with
@Model.Attribute
(uppercase "M").
Seems like your view is typed dynamic
. Set the right type on the view and you'll see the error go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With