Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • In regard to case 2 it is ok to have a field named note.userId as long as you are using the same (or similar structured) viewmodel to recieve the postback. The modelbinder will take care of binding the fields... Commented Oct 20, 2012 at 15:37
  • @Jan Hansen Thank you for your comment, could you review my edited question again please? I need a little more your help ^^ Commented Oct 20, 2012 at 15:51
  • As webdeveloper mentions in a comment to the answer below, RedirectToAction clears the state of the viewmodel, hence you should use return View() when there are model errors. Other than that ModelState.IsValid should work just fine with the NoteViewModel as input for your action method... Commented Oct 22, 2012 at 19:10