hamackey
hamackey

Reputation: 51

Pass viewdata to a create form MVC3

I passed the id from one controller (Index) to another (Details), and added a ViewData statement to save data in the details view, and forward it to a View on another controller.

@Html.EditorFor(model => model.PersonID)

How do I modify this statement to enter a ViewData element?

Upvotes: 0

Views: 139

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

You can't. Strongly typed helper such as EditorFor work only with strong types. ViewBag is weak typing. So don't use ViewBag. Use a view model instead.

Upvotes: 3

Related Questions