0

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?

Pablo Claus
  • 5,886
  • 3
  • 29
  • 38
hamackey
  • 51
  • 1
  • 4

1 Answers1

3

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.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928