3
I need to update all my data View
, i call this function to update, passing the company parameter:
function CarregaCaixa() {
var Empresa = $("#EmpresaFiltroId").val();
var url = "/Caixa/CarregaCaixa";
$.ajax({
url: url
, type: "POST"
, data: { empresaId: Empresa }
, datatype: "html"
, success: function (data) {
$("#model").html(data.model);
}
});
}
And in the controller
I return like this:
var model = new CaixaViewModel();
model.EmpresaList = new SelectList(empresa, "Id", "Value");
model.ValorSaida = ValorSaida.ToString("C2");
model.ValorEntrada = ValorEntrada.ToString("C2");
model.EmpresaFiltro = new SelectList(empresa, "Id", "Value");
model.EmpresaFiltroId = empresaId;
model.CaixaList = union;
return Json(new { model });
How can I return all the data at once, I’m updating my data View
, has some way without needing to pass field by field.
Mariana, have you seen this post? -> How to send 2 objects from Controller to View in C# ASP.Net MVC? - https://answall.com/questions/91021/comor-enviar-2-objects-do-controller-para-a-view-no-c-asp-net-mvc
– FabioIn
@Fabioin I did not want to send one or other objects, I wanted to update the whole View. I will take a look at the post. The form of the post, is by
ViewData
orViewBag
. I wanted to see if you had something that would update all the data.– Mariana
I use the viewmodel, p update the View, works in the load, only I need the user to pass a parameter, then filter the data and update again, with the filter, as the parameter provided.
– Mariana
You need to return to
View
forcontroller
the technique would be withPartialView
and update thisView
by the controller ... I think that’s what you need?– novic
@Virgilionovic I didn’t want to use
PartialView
, wanted to update everything in a single page, because forPartialView
I would need to make another page to update.– Mariana
Remembering that I use
core
– Mariana
I would make a party views, but if you don’t want to work with angular reactive framework, Reactjs or Vue
– novic