Cascade DropDownLists in ASP.NET MVC 5 and Entity Framework - Tutorial

For Consultation : +91 9887575540

Stay Connected :

Hi guys today I am going to demonstrate that how we can create cascade dropdown list control in asp.net MVC 5 using Razor and entity framework. Usually we need this solution.

  1. Create a new Project. Open Visual Studio 2013.
  2. Go to “File” => “New” => “Project…”.
  3. Select “Web” in installed templates.
  4. Select “ASP.NET MVC Web Application”.
  5. Enter the Name and choose the location.
  6. Click “OK”.

Create Database Tables (country and state)

Following is the database script of country and state

Step 3: Now open visual studio and add an edmx file (which connect your database).here I am not telling you how to create edmx file , for it you can visit my old blogs based on entity framework.

Step 4: Crate new empty Home Controller.

Step 5. Write following code in Home controller.




@Html.DropDownListFor(Model => Model.countries, new SelectList(ViewBag.Countries as System.Collections.IEnumerable, “country_id”, “country_name”), “Select a Country”, new { id = “dd_Country” })


@Html.DropDownListFor(Model => Model.states, new SelectList(Enumerable.Empty(), “state_id”, “statename”), “Select a State”, new { id = “ddState” })

Download Source Code

ASP.NET Core 2.0 Online Training

ASP.NET Core 2.0 Online Training

Select your currency