0

I need to remove unobtrusive validation in my ASP.net MVC project because I am dynamically creating drop down lists.

I am attempting to use

    @{HtmlHelper.ClientValidationEnabled = false;}

but I get the error "HtmlHelper does not contain a definition for ClientValidationEnabled".

Does anyone know how to fix that or perhaps another solution to this problem? I really only need it disabled for one form.

Three33Steele
  • 51
  • 1
  • 9
  • Try "EnableClientValidation(bool)": https://learn.microsoft.com/en-us/dotnet/api/system.web.mvc.htmlhelper.enableclientvalidation?view=aspnet-mvc-5.2 – pcalkins Jul 30 '21 at 20:38
  • I assume this is in my controller for the view? – Three33Steele Jul 31 '21 at 21:21
  • right in the view methinks... @{ Html.EnableClientValidation(false); } see this thread: https://stackoverflow.com/questions/3695186/enable-client-validation-in-razor-views-asp-mvc-3 – pcalkins Jul 31 '21 at 23:57
  • 1
    @(ViewContext.ClientValidationEnabled = true) is what worked best for me! – Three33Steele Aug 02 '21 at 12:05

1 Answers1

2

@(ViewContext.ClientValidationEnabled = true)

Three33Steele
  • 51
  • 1
  • 9