tags:

views:

30

answers:

2

Hi,

In a View, I've created a <form> that posts some data to another Controller, which is different from that one that redirected me to the View. In this second controller, i perform some data validations and then, if errors are found, I need to redirect the user again to the source View but with the edited ModelState (so that i can show the validation errors).

Any tips?

+2  A: 

Instead of redirecting back to the original controller can't you just return View("~/Views/FirstController/Index.aspx")? Another option would be to store the model inside TempData before redirecting and fetching it back from TempData in the first controller if available.

Darin Dimitrov
+1  A: 

Yes, you can use PRG pattern like Darin said.

Cheers!

rrejc
Thanks, nice link!
Marco