1
I have my grid with the html helper Pagedlist
<div class="table-responsive">
<table class="table table-hover">
<tr>
<th>
@Html.ActionLink("Id", "Index", new { OrderBy = ViewBag.OrdenaPorId, FiltroPagina = ViewBag.FiltroPagina })
</th>
<th>
@Html.ActionLink("Nome", "Index", new { OrderBy = ViewBag.OrdenaPorNome, FiltroPagina = ViewBag.FiltroPagina })
</th>
<th>
@Html.ActionLink("Descrição", "Index", new { OrderBy = ViewBag.OrdenaPorDescricao, FiltroPagina = ViewBag.FiltroPagina })
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.Nome)
</td>
<td>
@Html.DisplayFor(modelItem => item.Descricao)
</td>
<td style="text-align:right;">
@Html.ActionLink("Editar", "Editar", new { id = item.Id }, new { @class = "btn btn-primary" })
<button class="btn btn-danger" onclick="deletar(@item.Id)">Deletar</button>
</td>
</tr>
}
</table>
</div>
<br />
Página @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) de @Model.PageCount
@Html.PagedListPager(Model, Pagina => Url.Action("Index", new { Pagina, Orderby = ViewBag.AtualOrder, FiltroPagina = ViewBag.FiltroPagina }))
By clicking delete, it opens a modal, and the same makes a post to delete action
But here comes the problem,
If there is an error, you should return the error message, otherwise I need a "Reload" on my grid
The error message, ok, but what about Reload? how do I use Pagedlist?
$.ajax({
url: "Deletar",
type: "POST",
data: { Id: Id},
success: function (data) {
//Como faço o reload aqui?
},
error: function (data) {
//Mensagem de erro
}
});
well that Gypsy, worked, thanks, taking advantage, know some responsive grid to indicate? I am suffering with my choices lately, rsrs
– Rod
@Rod Which one are you using? What exactly do you imagine as responsive?
– Leonel Sanches da Silva
I’m using the same pagedlist, responsive only that does not break in the layout
– Rod
Combined use of Bootstrap for Views, or the Zurb Foundation, but the Foundation requires more manual work.
– Leonel Sanches da Silva
but what about your data grid? datagrid, which one uses?
– Rod
This: http://www.datatables.net/
– Leonel Sanches da Silva