2
Goodnight!
I’m working on a Bed Management project.
In a particular View, I am displaying the registered Wards, and for filtering purposes, a field where one can research by the name of the Department to which certain(s) ward(s) belongs(at).
As shown below:
For this, I am using the ajax Helper Ajax.BeginForm
to return a Partialview and popular the table. The problem is that I am getting a separate view only with the data. I have already searched here on the site, some people had the same problem and included Unobtrusive in _Layout, but I have already done this. I’ve checked everything over and over, and I can’t identify what’s going on.
- In Web.config is already set to Unobtrusive for True
- I have already included the package validate. Unobtrusive
- Since _Layout does not load Unobtrusive, I already made this correction.
- My controller is equipped with Action Partialviewresult
In Sick Bay I have:
[HttpPost]
[ValidateAntiForgeryToken]
public PartialViewResult IndexDep(string pesquisa)
{
return PartialView((_enfermariaAppService.ObterPeloNomeDoDepartamento(pesquisa)));
}
In Index (the image above) I have the following code:
//AjaxOptions
@{
var ajaxOpts = new AjaxOptions
{
UpdateTargetId = "tbBody",
HttpMethod = "Post",
};
}
//Formulário
@using (Ajax.BeginForm("IndexDep", ajaxOpts))
{
@Html.AntiForgeryToken()
<div class="form-inline">
@Html.TextBox("pesquisa","", new { @class = "form-control", @placeholder="Pesquise pela sigla do departamento" })
<input type="submit" value="Pesquisar" class="btn btn-info" />
</div>
}
//Tabela onde deveria ser repassado a partialView
<table class="table table-bordered">
<thead>
//Cabeçalhos...
</thead>
<tbody id="tbBody">
//Linhas...
</tbody>
From now on, I would like to thank everyone who can collaborate.
Hug.
jquery.unobtrusive-ajax.js
is not the same asjquery.validate.unobtrusive.min.js
? Or I’m making a horrible mess.– Samuel Gomes
They are not the same thing no. One is for validation, the other is necessary for the
Ajax.BeginForm
.– JamesTK
There was associate that both were equal, but in different versions. Thank you very much friend. I had already searched in four literatures and did not realize this my confusion. Grateful. Hugs
– Samuel Gomes