mardi 2 juin 2015

how to compare textbox with checkbox in mvc

I have This ViewModel :

   public string Address { get; set; }
   [DisplayName("Do you want Reward ؟")]
   public bool IsReward { get; set; }

   [Range(0,int.MaxValue,ErrorMessage="Please enter integer number")]

   public int Reward { get; set; }

In View IsReward by default is unchecked , I want when User check Isreward and post view , If Reward textbox is empty I show message to user " please enter Reward " .

I want Check it by DataAnnotation. How can I do this ?

Aucun commentaire:

Enregistrer un commentaire