good morning
I have the following code to assign a list to my DropDownList from the controller
ViewBag.Ciudad = new SelectList(GetCiudadAll, "idCiudad", "NombreCiudad");
in the view
@Html.DropDownList("Ciudad", (SelectList)ViewBag.Ciudad, "-- Seleccione Ciudad --", new { @class = "form-control", required = "required" })
but it is necessary that for certain types of Tax the list of cities be changed for this I realize this in the view
<script type=“text/javascript”>
$('#TipoImpuesto').change(function() {
if ($('#TipoImpuesto').val() == ('CO2')) {
{
var CiudadesPaises = ['Mexico', 'Caracas', 'Bogota', 'Lima', 'Quito'];
@ViewBag.Ciudad=CiudadesPaises;
}
}
});
</script>
but the DropDownList does not change the list that you have to display, how or why can not the new list be displayed in my view?