Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

39 lines
1.6 KiB
C#

using System.Configuration;
using System.Web.Util;
namespace System.Web.UI {
public static class ValidationSettings {
private static UnobtrusiveValidationMode? _unobtrusiveValidationMode;
/// <summary>
/// Gets or sets the client side validation mode of the application.
/// </summary>
public static UnobtrusiveValidationMode UnobtrusiveValidationMode {
get {
if (_unobtrusiveValidationMode == null) {
string configValue = ConfigurationManager.AppSettings["ValidationSettings:UnobtrusiveValidationMode"];
object value = PropertyConverter.EnumFromString(typeof(UnobtrusiveValidationMode), configValue);
if (value == null) {
_unobtrusiveValidationMode = (BinaryCompatibility.Current.TargetsAtLeastFramework45) ? UnobtrusiveValidationMode.WebForms : UnobtrusiveValidationMode.None;
}
else {
Debug.Assert(value is UnobtrusiveValidationMode);
_unobtrusiveValidationMode = (UnobtrusiveValidationMode)value;
}
}
return _unobtrusiveValidationMode.Value;
}
set {
if (value < UnobtrusiveValidationMode.None || value > UnobtrusiveValidationMode.WebForms) {
throw new ArgumentOutOfRangeException("value");
}
_unobtrusiveValidationMode = value;
}
}
}
}