Link to home
Start Free TrialLog in
Avatar of programmerist 1983
programmerist 1983Flag for Türkiye

asked on

how to disabble required attributes MVC model?

i have a model :
  [Range(1, 24, ErrorMessage = "Invalid Hour")]
    public int val1{ get; set; }
    [Required(AllowEmptyStrings = true)]
    public string val2 { get; set; }

Open in new window

i have a edit action also i have view page. There are 2 textboxes val1.text, val2.text if i write fill view form (i am not writing any value on val1) return InvalidHour. i want to give ability to set empty value (not writing something on val1). How to do it?
Avatar of programmerist 1983
programmerist 1983
Flag of Türkiye image

ASKER

are you living? dont write any thing !!!!
ASKER CERTIFIED SOLUTION
Avatar of ambience
ambience
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial