public class Data { private string _days; [Range(0, 100)] [RegularExpression(@"^[0-7]*$")] [DefaultValue("0")] //I also tried [DefaultValue(typeof(string), "0")] and public string DEF_VAL="0" [DefaultValue(DEF_VAL)], but did not work. public string Days { get{ return _days; } set { Validator.ValidateProperty(value, new ValidationContext(this, null, null){MemberName="Days"}); _days=value; } } }
{ get{ return _days; } set { Validator.ValidateProperty(value, new ValidationContext(this, null, null){MemberName="Days"}); if(value!="") _days=value; else _days="0"; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)