Q: modelstate not valid due to null database values The modelstate in the figure below is being validated as true. Some DB fields are assigned to null while they are deemed as required which is creating as error preventing the modelstate from being valid.
I tried assigning them to an arbitrary value using "=" as shown below, but the assignment didn't work, they are still "null" Any Suggestions on how to assign a value to those fields? 
  myURL.tbl_Category.CategoryName=myURL.tbl_Category.OtherName;



A: The modelstate error occurs during model binding. Assigning it a value after the fact will not change anything. If you want to make sure this doesn't happen, you need to modify the view that this model is bound from to provide a value for that field.
Also, if it is allowed to be null in the database, and you don't want to force the user to provide a value for that field, then you shouldn't make it required. The correct solution to this problem is either to remove the [Required] data annotation for the field or just continue forcing the user to provide a value for it, causing a modelstate error every time they fail to do so and returning the view with validation errors.
