

$( "#ddlCountry" ).Pega offers two country picker controls OOTB: Pick-Country and Pick-Country-i18n with two differences: one in its appearance in the user interface (UI) and the other in the country codes underneath it.ddlCountry.append($( "" ).val(country.CountryId).html(country.CountryName)).ddlCountry.append($( "" ).val( '' ).html( 'Please Select Country' )).Now, let's go in MVC project and add a Controller.Īfter that, create an action method for View and View page. throw new HttpResponseException( new HttpResponseMessage ).CascadingLogic objCasc = new CascadingLogic().public class CascadingDetailsController : ApiController.Now, create the API methods and call the methods one by one. lstCity = (a => a.StateId = stateId).ToList() Īfter that, we will add an API Controller.JobPortalEntities dbEntity = new JobPortalEntities().Now, we will write the logic for binding the Country, State and City, So, I create a folder Business Logic and take a class CascadingLogic.cs and write the logic. Select "New Connection" and give the connection details, then select database -> click OK. So for this, go to Models folder ->right-click -> Add -> New item -> ADO.NET Entity Data Model -> click Add -> select database first approach->click Next. Now, add tables in web API project using Entity Framework. Open Visual Studio and go to File->New ->Web application ->select MVC ->OK.


So now, let us add the first MVC project.

Now, we need to create an MVC application but we will create two projects here - one is Web API project for the creation of service and the other one is MVC project for consuming that service. We have to create three tables - Country, State, and City. Finally, here, we will use MVC, Web, jQuery, and SQL Server. If we select a country, then it should display country related states and when we select a state, it should display state-related cities. Here, I am using three tables - Country, State, and City - respectively. Today, in this article, I will explain how to create a cascading dropdown list using MVC, Web API, and jQuery.
