c# - Apply validation for few sections in the same view in mvc -


i developing mvc project using c#. have 1 model called employeeeducationdetails. lets have @ have created

public class educationlist {   public list<employeeeducationdetailtable> employeeeducationlist { get; set; }    public educationlist()   {     employeeeducationlist = new list<employeeeducationdetailtable>();   }    public virtual employeemaintable employee_maintable { get; set; }   public icollection<employeequalificationtypetable> employee_qualficationtypetable { get; set; } }  public class employeeeducationdetailtable {   public int employeeid { get; set; }    public int employeeeducationdetailid { get; set; }    [required(errormessage = "select qualification")]   public int? employeequalificationtypeid { get; set; }    [required(errormessage = "enter institute name")]   public string employeeinstitutename { get; set; }    [required(errormessage = "enter year of pass")]   public datetime? employeeyearofpass { get; set; }    [required(errormessage = "enter percentage")]   public string employeepercentage { get; set; } } 

until not facing problem. our requirement needs satisfy these conditions

  1. i have design 4 division on same view sslc, puc, degree, post degree using same model.
  2. need validate 1 section among 4 divisions because education mandatory employee.
  3. if data entered division has validate.

please give me idea this. appreciated.

note:here passing list.count create 4 division dynamically , have use same model i.e. educationlist

if design permits, may provide checkbox against each division , use 'requiredif' conditional validation approach.

please visit following links know more on this:

requiredif conditional validation attribute

flexible conditional validation asp.net mvc sample code

hope you.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -