Client-side validation in asp.net MVC is unobtrusive. To turn on client side validation and unobtrusive JavaScript, make sure the following 2 keys under appSettings element within web.config file is turned on. This will turn on client side validation and unobtrusive JavaScript for the entire application.
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
It possible to turn these features on/off using code. This features can be enabled or disabled in Application_Start() event handler in Global.asax.
protected void Application_Start()
{
HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
HtmlHelper.ClientValidationEnabled = true;
}
It possible to turn on/off for a specific view.
@{
Html.EnableClientValidation(true);
Html.EnableUnobtrusiveJavaScript(true);
}
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
It possible to turn these features on/off using code. This features can be enabled or disabled in Application_Start() event handler in Global.asax.
protected void Application_Start()
{
HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
HtmlHelper.ClientValidationEnabled = true;
}
It possible to turn on/off for a specific view.
@{
Html.EnableClientValidation(true);
Html.EnableUnobtrusiveJavaScript(true);
}
No comments:
Post a Comment