I have a model like this
public string Name { get; set; }
public IEnumerable ProjectMembersId { get; set; }
The property Na
Try it with BindProperty
method:
public class CustomModelBinder : DefaultModelBinder
{
protected override void BindProperty(ControllerContext controllerContext,
ModelBindingContext bindingContext,
System.ComponentModel.PropertyDescriptor propertyDescriptor)
{
if (propertyDescriptor.Name == "ProjectMembersId")
{
var list = new List(5);
var form = controllerContext.HttpContext.Request.Form;
var names = form.AllKeys.Where(x => x.StartsWith("dhxGridObj"));
foreach (var name in names)
{
int i;
if (int.TryParse(form.Get(name), out i))
{
list.Add(i);
}
}
SetProperty(controllerContext, bindingContext, propertyDescriptor, list);
}
else
{
base.BindProperty(controllerContext, bindingContext, propertyDescriptor);
}
}
}