hi to all,
i'm new for MVC so kindly explain me how to validate unique key for Branch_code field.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
srujana thallam67 reputationPosted Jul 18, 2014, 6:00 AM EDT
If you want to validate Branch_code field in View page you can define there or you can give validation message at model also.
In model you can define like this.
public class Employee { [Required] public string Name { get; set; } [Required] [Email] public string Email{ get; set; } }Ramesh MaruthiRank #937 · 2.2K reputationPosted Jul 18, 2014, 7:45 AM EDT
{
[Key]
public int Branch_code{ get; set; }
}
if that doesn't works try in this way
jothi kumar102 reputationPosted Jul 19, 2014, 2:18 AM EDT
jothi kumar102 reputationPosted Jul 19, 2014, 6:01 AM EDT