Cascading dropdown in MVC Razor

Let us have two dropdown list. When one of them is changed the another one will populated. So far I know, the mvc dont have postback method. So, we are going to use javascripts and so on.
Here is our dropdowns. One is populated by the controller with the “DepartmentList” viewdata. And another one by the change event of the first one.
Now, add a javascripts change event for first dropdown which will call the “Test” function of the controller “Registration” and the function will return a JSON result. It is also sending a string named “did” consisting the selected value of the dropdown’s. After getting the result, bindings the text and values to the¬†targeted¬†dropdown.
At last create a function which will return a JSON type result. Here, the function calls another one to make a list for the selected index. Don’t be afraid about the “clsDesignation”. Its a model class consiting Designation ID and Name.
Continue reading