I have two dropdown lists in my view
For first dropdown list I have this code in View:
@Html.DropDownListFor(model => model.VacancyId, ViewBag.Teams as SelectList,new { @class = "greeting" })
And this in Controller
SelectList teams = new SelectList(db.Vacancy, "VacancyId", "VacancyName");
ViewBag.Teams = teams;
return View();
And here is model
public partial class Vacancy
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Vacancy()
{
this.Interwiers = new HashSet<Interwier>();
this.InvitationMails = new HashSet<InvitationMail>();
this.Interviews = new HashSet<Interview>();
this.MassLinks = new HashSet<MassLink>();
}
public int VacancyId { get; set; }
[Display(Name = "Вакансия")]
public string VacancyName { get; set; }
public Nullable<int> CompanyID { get; set; }
public virtual Company Company { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Interwier> Interwiers { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<InvitationMail> InvitationMails { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Interview> Interviews { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<MassLink> MassLinks { get; set; }
}
}
I need to set two dropdown lists . In one I select company, in second I will see vacancies related to this company. How to do this?
Thank's for help.