Search code examples
asp.net-mvc-3asp.net-mvc-3-areas

overriding appsetting values in mvc 3 areas


I have got appsetting for

<add key="ClientValidationEnabled" value="false" />
<add key="UnobtrusiveJavaScriptEnabled" value="false"  />

in the root config file.

which I want to override in the areas section to set the values to true. Now the Required Attribute on the Model validaton still does not do client validation as the flags are still set to false

Thanks


Solution

  • Inside a view you can set those to true using the Html property.

    @Html.ClientValidationEnabled = true;
    @Html.UnobtrusiveJavaScriptEnabled = true;
    

    In the area level, I think you can try by creating a simple web.config inside the corresponding folder and overriding those two as true.