先定义枚举
public enum CustomValidationType
{ Integer,

Double,

String,

Date,

Currency,

PostCode,

CID,

Email,

Url,

IP
}
再定义属性
public CustomValidationType Type
{
get
{
object obj = ViewState["Type"];
if (obj==null) return CustomValidationType.String;
return (CustomValidationType)ViewState["Type"];
}
set
{
ViewState["Type"] = value;
if (value == CustomValidationType.CID) MaxLength = CIDCount;
else if (value == CustomValidationType.PostCode) MaxLength = PostCodeCount;
else if (value == CustomValidationType.IP) MaxLength = IPCount;
else if (value == CustomValidationType.Date) MaxLength = DateCount;
else MaxLength = 0; }
}

解决方案 »

  1.   

    public enum vType
    {
    None,
    OnlyDate,
    OnlyNumber,
    OnlyDecimal
    }
    ________________________________________________________________________----
    private vType _vType;______________________________________________________________________________
    public vType VType
    {
    get{return _vType;}
    set{_vType = value;}
    }______________________________________________________________________
    switch(_vType)
    {
    case vType.OnlyNumber:
                                             ...........................
      

  2.   

    如果是windows 控件
    判断得呆吗应该重写什么函数
    switch(_vType)
    {
    case vType.OnlyNumber:
                                             ...........................
    ????
      

  3.   

    webcontrol事新建一个webcontrol控件库的项目还是
    再一个项目中添加一个 servercontrol (.ascx)