0
I need to present a list of results according to the form below, but the research is not presenting the result. To action in controller is not being triggered.
@using (Html.BeginForm())
{
<div class="form-group">
@Html.LabelFor(model => model.ProfissionalID, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownList("ProfissionalID", Model.Profissionais, "", new Dictionary<string, object> { { "class", "chosen-select" }, { "data-placeholder", "Selecione" } })
@Html.ValidationMessageFor(model => model.ProfissionalID, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Pesquisar" class="btn btn-default" onclick="return efetuarPesquisa()" />
</div>
</div>
}
<div id="resultado">
</div>
function efetuarPesquisa() {
if (!$('#ProfissionalID').val()) {
$.MessageBox("Selecione o profissional");
$('#ProfissionalID').focus();
return false;
}
$("#resultado").load('/Lancamento/BuscarLancamentosProfissional/' + $("#ProfissionalID").val());
return true;
}
Action that will fill the list:
[HttpPost]
public PartialViewResult BuscarLancamentosProfissional(int profissionalId)
{
var model = _edicaoMapper.Mapear(_lancamentoService.BuscarLancamentosProfissional(profissionalId));
return PartialView("Edit", model);
}