I play with MVC3 using Razer syntax, although I think the problem is more general.
In the controller, I have something like:
ViewModel.User = New User(); // The model I want to display/edit ViewModel.SomeOtherProperty = someOtherValue; // Hense why need dynamic Return View();
My view inherits from System.Web.Mvc.ViewPage
But if I try to do something like:
<p> @Html.LabelFor(x => x.User.Name @Html.EditorFor(x => x.User.Name </p>
I get the error: "The expression tree may not contain a dynamic operation"
However, using ViewPage seems pretty common, as does EditorFor / LabelFor. Therefore, I would be surprised if there was no way to do this - appreciate any pointers.
Saqib source share