two dynamic dropdown whenever we change 1st dropdown on change event the sencond dropdown value update based on 1st dropdown value.
Loading
two dynamic dropdown whenever we change 1st dropdown on change event the sencond dropdown value update based on 1st dropdown value.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prasad RaveendranPosted Jun 30, 2024, 7:24 PM
In an ASP.NET MVC 5 application, you can create dynamic dropdown lists where the second dropdown's options depend on the selection of the first dropdown. This involves the use of AJAX to fetch the relevant data from the server when the first dropdown's value changes.
Controller
view
In this example:
countryDropdown) is populated with a list of countries.GetCitiesaction method in theHomeController.GetCitiesmethod returns a list of cities filtered by the selected country.cityDropdown) is then populated with the filtered list of cities.Make sure to include the jQuery library in your project, as it's used for the AJAX request in the view.
JeremkidshjfPosted Jun 28, 2024, 7:30 AM
C# sample code for creating a linked dropdown list using spire.xls:
Refer to: https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/NET-Dropdown-List-Create-Excel-Dropdown-List-in-C-and-VB.NET.html
Amit MohantyPosted Jun 28, 2024, 6:54 AM
Check the below example:
Models:
Controllers:
Views: