Assuming I have a specific problem which I need to remove some dataannotations's required attributes, how can I do this?
I know about view-model but I don't want to use it for some reasons.
Assuming I have a specific problem which I need to remove some dataannotations's required attributes, how can I do this?
I know about view-model but I don't want to use it for some reasons.
If you just want to disable validation for a single field in client side then you can override the validation attributes as follows:
@Html.TexBoxFor(model => model.SomeValue,
new Dictionary<string, object> { { "data-val", false }})
Here is the source for more answers
this will disable the validations on certain elements based on a selector
var validationSettings = $.data($('#formToValidateId').get(0), 'validator').settings;
validationSettings.ignore = '.ignore';
check this blog for more info