views:

27

answers:

1
+1  Q: 

request.form issue

is there a way I can get values out of "Request.Form["person"] so I can set some of the values to an Entity?

+1  A: 

It's considered a best practice to avoid using the Request object with ASP.NET MVC.

ASP.NET MVC supports Model Binding, which allows your Controller's action methods to accept an object. The default binder automatically looks for Request values that match the object's properties and binds them to parameter:

public ActionResult SavePerson(Person person)
{
     //Save the person object

     return View(); 
}

You can write custom binders in cases where the default binder doesn't meet your requirements.

More on model binding: http://weblogs.asp.net/nmarun/archive/2010/02/25/asp-net-mvc-model-binding.aspx

Dave Swersky
+1 for best practice!!!
rockinthesixstring