mvc 5 dropdown list updates

224 views Asked by At

I am currently developing a site with asp.net MVC 5 and EF 6. I would like a simple best practice approach on how to populate a drop down list with States bases on a selected Country in another drop down list.

I have a Country model and a StateModel with data from DB. I have implemented a ViewModel with:

[Display(Name = "Country")]
public int SelectedCountryModelId { get; set; }
public IEnumerable<SelectListItem> CountryList { get; set; }

And a similar one for StateModel. I have a controller that loads the country list.

I am looking for a solution similar to this excellent one: http://www.codeproject.com/Articles/730953/Cascading-Dropdown-List-With-MVC-LINQ-to-SQL-and-A

The above solution is in MVC 3 and I was hoping for some nicer solution with MVC. Is this possible without javascript code? I am not that skilled in javascript.

0

There are 0 answers