How to disable Client Side Validation with ASP.NET 5?
I tried to set ClientValidationEnabled to false in config.json like here but I still have data-val-*
attributes in html elements.
Answer :
services.AddMvc()
.ConfigureMvcViews(options =>
{
options.HtmlHelperOptions.ClientValidationEnabled = false;
});
I don't believe configuring this via AppSettings is supported out of the box in ASP.NET 5. One option is to programmatically configure this in your Startup
class's ConfigureServices
method:
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.AddViewOptions(options =>
{
options.HtmlHelperOptions.ClientValidationEnabled = false;
});
}
The ClientValidationEnabled
was moved to an HtmlHelperOptions
property on MvcViewOptions
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With