I simply want a text box editor field to appear with a value in it that has been passed with a ViewBag for example if ViewBag.Savings contained '6':
I tried something like:
@Html.EditorFor(model => model.Value, ViewBag.Savings)
@Html.ValidationMessageFor(model => model.Value)
I get the compiler error: 'Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'EditorFor' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.'
What's the correct syntax?
Best Answer
I think EditorFor needs a model ->
then
For ViewBag you could do: