Implement a function that uses ajax
to communicate with a controller (DetalheNotaFiscalController
, for example):
function DetalharNotaFiscal(idNota) {
$.post("/DetalheNotaFiscal/Detalhar", { id: idNota }).done(function (retorno) {
$("#detalhe_nf").html(retorno); //id da div com a partial, recebendo o retorno da controller
}).error(function (xhr, ajaxOptions, errorThrown) {
alert("Erro Interno. Favor contatar o administrador.");
});
}
In the controller:
[HttpPost]
public ActionResult Detalhar(string id)
{
//TODO: Recuperação da nota através do id
var model = TODO; //model da partial view
return PartialView("Index", model);
}
Using
ajax
. You must implement some javascript function that monitors the changes and searches the server for the necessary information.– Richard Dias
You have some example Richard Dias?
– Ricardo de Souza
I believe this may give you an idea of what to do: http://stackoverflow.com/questions/19392212/how-to-use-jquery-or-ajax-to-update-razor-partial-view-in-c-asp-net-fora-mvc-p
– Richard Dias