1
I own a page with a button that calls a modal and in this modal there is a table with the products, that when I click on a record of the products it is added on my page. Adding only the first product, more than one is not added.
have it in my controller
, a function to call the Partial
.
public ActionResult NovaLinhaProduto()
{
Produto produto = _produtoRepository.GetById(int.Parse(Request["id"]));
var ordemCompraProduto = new OrdemCompraProdutoViewModel();
ViewBag.produto = produto;
return PartialView("_LinhaProduto", ordemCompraProduto);
}
and I have this and mine modal, that of the one append
on my page.
$.get('/OrdemCompra/NovaLinhaProduto?id=' + id, function (template) {
parent.$("#Produtos_Adicionados").append(template);
});
View:
<div id="Produtos_Adicionados" name="Produtos_Adicionados" class="form-group">
@Html.LabelFor(model => model.Produto, new { @class = "control-label col-md-2" })
<div class="col-md-10">
<img src="@Url.Content("~/Content/img/lupa.gif")" id="PopUp_produtos" style="cursor:pointer;" class="btn btn-white">
</div>
@if (Model != null)
{
if (Model.OrdemCompraProdutoss != null)
{
foreach (var ordemProdutos in Model.OrdemCompraProdutoss)
{
@Html.Partial("_LinhaProduto", ordemProdutos);
}
}
}
</div>
Not giving you any javascript error? Very strange not working..
– CesarMiguel
Cesarmiguel is not here.
– jp_almeida
You can put the stretch of View where that Partial should be added?
– Leonel Sanches da Silva
I put a breakpoint in the function that calls the partial, in the second addition the break goes straight to Global.asax.Cs and is loading the page.
– jp_almeida
I do not know face I think it should be taking to load. Very strange. There are times that the page just keeps loading and takes.
– jp_almeida
He added, but I entered the breakpoint and I was walking very slowly with it there worked, does anyone have any solution? It must be a matter of time.
– jp_almeida
The code of the Partial in itself. At first it’s all right.
– Leonel Sanches da Silva
Gypsy he added but it’s the way I told you, it’s not taking long to render the partial?
– jp_almeida