0
I have a form that has two @Html.Dropdownlistfor among other fields. However, when changing the first Dropdownlistfor I need to update the values of the other dropdownlist by passing its id as parameter...
@model EP.IdentityIsolation.Domain.Entities.Cadastro.Atividade
@using (Html.BeginForm("SalvarHistoria", "Historia", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-body">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Cliente, htmlAttributes: new { @class = "control-label" })
@Html.DropDownListFor(model => model.Cliente.Id, @ViewBag.ListaClientes, "Nenhum", new { @class = "form-control", required = "true", onchange = "?????" })
<small>@Html.ValidationMessageFor(model => model.Cliente, "", new { @class = "text-danger" })</small>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Oportunidade, htmlAttributes: new { @class = "control-label" })
@Html.DropDownListFor(model => model.Oportunidade.Id, @ViewBag.ListaOportunidades, "Nenhum", new { @class = "form-control", required = "true" })
<small>@Html.ValidationMessageFor(model => model.Oportunidade, "", new { @class = "text-danger" })</small>
</div>
<div class="form-group">
@Html.LabelFor(model => model.IsExecutado, htmlAttributes: new { @class = "control-label" })
<div class="checkbox">
@Html.EditorFor(model => model.IsExecutado)
<small>@Html.ValidationMessageFor(model => model.IsExecutado, "", new { @class = "text-danger" })</small>
</div>
</div>
</div>
<hr />
<div class="form-actions" align="right">
<button type="button" class="btn btn-danger waves-effect waves-light"><i class="fa fa-times" aria-hidden="true"></i></button>
<button type="submit" class="tst3 btn btn-success waves-effect waves-light m-r-10" onclick="validaDataHora();"> <i class="fa fa-check"></i> Salvar</button>
</div>
}
passing the
ID
of the first select or thevalue
of<Option>
selected?– Leandro Angelo
yes, when selecting one of the options the second Dropdownlistfor should have the values updated!
– Eluander J. F. Lopes
Let me see if I understand, when for example you select the value of a
<option>
in the first<select>
has to change the second<select>
right? But change how? Loading Customer Opportunities Chosen or Opportunities are already loaded and you just need to select it?– Matheus Cuba
Yes, I need to carry the opportunities of the chosen customer.
– Eluander J. F. Lopes