How to use Dropdownlistfor cascading in Asp.net mvc

Asked

Viewed 37 times

0

I use Select2 to popular a dropdown and would like to after choosing the item I update another dropdown or a label by doing a search.

ex:

@Html.DropDownListFor(m => m.IdEstado, Model.CarregarEstado.Select(x => new SelectListItem { Text = x.Nome, Value = x.IdEstado.ToString() }), new { @class = "form-control select2_tipo" })

need that after selecting the state search in the bank which country it belongs to.

Grateful

Odysseus

1 answer

0

I believe you will have to use javascript for when you select the state, javascript/Ajax pass to the state controller via httpget, go to the bank and return variable with the country and fill the field with the name of the desired country in your View.

No Bank you will have to register the State and the corresponding Country.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.