I have the following route:
routes.MapRoute(
\"Default\", // Route name
\"{c
Try something like this (not tested):
public class CustomModelBinder : DefaultModelBinder
{
protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor)
{
if (bindingContext.ModelType == typeof(ProductInfo)
&& String.Compare(propertyDescriptor.Name, "ProductID", true) == 0)
{
var id = (int)controllerContext.RouteData.Values["id"];
var productInfo = bindingContext.Model as ProductInfo;
productInfo.ProductID = id;
return;
}
base.BindProperty(controllerContext, bindingContext, propertyDescriptor);
}
}