📄 rangevalidator.cs
字号:
using System;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for RangeValidator.
/// </summary>
//.custom instance void System.Web.UI.ToolboxDataAttribute::.ctor(string)
public class RangeValidator : BaseCompareValidator
{
public RangeValidator() : base()
{
}
protected virtual void AddAttributesToRender(HtmlTextWriter writer)
{
this.AddAttributesToRender(writer);
if (this.RenderUplevel)
{
writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid");
writer.AddAttribute("maximumvalue", this.MaximumValue);
writer.AddAttribute("minimumvalue", this.MinimumValue);
}
}
protected virtual bool ControlPropertiesValid()
{
string local0;
string local1;
string[] local2;
local0 = this.MaximumValue;
if (!(System.Web.UI.WebControls.BaseCompareValidator.CanConvert(local0, this.Type)))
{
local2 = new String[4];
local2[0] = local0;
local2[1] = "MaximumValue";
local2[2] = this.ID;
local2[3] = System.Web.UI.PropertyConverter.EnumToString(typeof(ValidationDataType), this.Type);
throw new HttpException(System.Web.HttpRuntime.FormatResourceString("Validator_value_bad_type", local2));
}
local1 = this.MinimumValue;
if (!(System.Web.UI.WebControls.BaseCompareValidator.CanConvert(local1, this.Type)))
{
local2 = new String[4];
local2[0] = local1;
local2[1] = "MinimumValue";
local2[2] = this.ID;
local2[3] = System.Web.UI.PropertyConverter.EnumToString(typeof(ValidationDataType), this.Type);
throw new HttpException(System.Web.HttpRuntime.FormatResourceString("Validator_value_bad_type", local2));
}
if (System.Web.UI.WebControls.BaseCompareValidator.Compare(local1, local0, ValidationCompareOperator.GreaterThan, this.Type))
{
local2 = new String[3];
local2[0] = local0;
local2[1] = local1;
local2[2] = this.ID;
throw new HttpException(System.Web.HttpRuntime.FormatResourceString("Validator_range_overalap", local2));
}
return this.ControlPropertiesValid();
}
protected override bool EvaluateIsValid()
{
string local0;
local0 = this.GetControlValidationValue(this.ControlToValidate);
if (local0.Trim().Length == 0)
return true;
if (System.Web.UI.WebControls.BaseCompareValidator.Compare(local0, this.MinimumValue, ValidationCompareOperator.GreaterThanEqual, this.Type))
return System.Web.UI.WebControls.BaseCompareValidator.Compare(local0, this.MaximumValue, ValidationCompareOperator.LessThanEqual, this.Type);
return false;
}
public string MaximumValue
{
get
{
object local0;
local0 = this.ViewState["MaximumValue"];
if (local0 != null)
return (String) local0;
return System.String.Empty;
}
set
{
this.ViewState["MaximumValue"]= value;
}
}
public string MinimumValue
{
get
{
object local0;
local0 = this.ViewState["MinimumValue"];
if (local0 != null)
return (String) local0;
return System.String.Empty;
}
set
{
this.ViewState["MinimumValue"]= value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -