Hello,
Let's say I've the following model
public class MyClass
{
public type1 Property1 { get; set; }
public type1 Property2 { get; set; }
public type1 Property3 { get; set; }
public type1 Property4 { get; set; }
public type1 Property5 { get; set; }
}
I would, for instance, like to bind only the first 3 properties. How can I do so Using one of the Overload for TryUpdateModel() like this
TryUpdateModel<TModel> Method (TModel, String, String[], String[])
EDIT
I don't update my model on the action method but rather using an OnActionExecuting filter like this:
public class RegistrationController : Controller
{
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
var serialized = Request.Form["formViewModel"];
if (serialized != null)
{
formViewModel = (FormViewModel)new MvcSerializer().Deserialize(serialized);
TryUpdateModel(formViewModel);
}
else
formViewModel = (FormViewModel)TempData["formViewModel"] ?? new FormViewModel();
}
//All the action methods are here
}
So, I'd like to exclude some of the properties depending on which action the view is posting back.
Thanks for helping