I am getting this strange issue in MVC 3.
I have a strongly typed view and a controller which has a SaveMethod(Employee emp).
But when i click SAVE, it is not hitting Save method and throws below error.
I think there may be a model binder issue. But how i know which property is a problem?
Its difficult for me to find a property from 50
Exception:
Unable to cast object of type 'System.Int32' to type 'System.String'.
Source: System.ComponentModel.DataAnnotations
StackTrace
at System.ComponentModel.DataAnnotations.StringLengthAttribute.IsValid(Object value) at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value, ValidationContext validationContext) at System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(Object value, ValidationContext validationContext) at System.Web.Mvc.DataAnnotationsModelValidator.d_1.MoveNext() at System.Web.Mvc.ModelValidator.CompositeModelValidator.d_5.MoveNext() at System.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
How do i check which property causes this issue?