This question is locked. New answers and comments are not allowed.
Hi, I have a two level hierarchy grid using ajax binding.
On the second level, the record can be editted in a popup dialog.
Everything is working fine, the method on the controller is being called when the user clicks on the "ok" button in the popUp edit dialog, the record is updated to the database and the GridModel is returned, but the popup remains opened and the underlying grid does not gets updated. Am I missing something?
My detail view code...
.DetailView(details => details.ClientTemplate(
Html.Telerik().Grid<Gefico.Domain.Financeiro.AgenciaBancaria>()
.Name("grid-agencias-<#= ID #>")
.Localizable("pt-BR")
.DataKeys(keys => keys.Add(a => a.ID))
.Columns(columns =>
{
columns.Bound(ag => ag.Banco.ID);
columns.Bound(ag => ag.Codigo);
columns.Bound(ag => ag.Telefone);
columns.Command(cmd =>
{
cmd.Edit().ButtonType(GridButtonType.BareImage);
cmd.Delete().ButtonType(GridButtonType.BareImage);
});
})
.Editable(editing =>
editing.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(true))
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("AjaxSelect", "AgenciaBancaria", new { idBanco = "<#= ID #>" })
.Delete("AjaxDelete", "AgenciaBancaria")
.Update("AjaxSave", "AgenciaBancaria", new { idBanco = "<#= ID #>" })
)
.Pageable()
.Sortable()
.ToHtmlString()
)
)
... and my update controller method:
Thanks!
On the second level, the record can be editted in a popup dialog.
Everything is working fine, the method on the controller is being called when the user clicks on the "ok" button in the popUp edit dialog, the record is updated to the database and the GridModel is returned, but the popup remains opened and the underlying grid does not gets updated. Am I missing something?
My detail view code...
.DetailView(details => details.ClientTemplate(
Html.Telerik().Grid<Gefico.Domain.Financeiro.AgenciaBancaria>()
.Name("grid-agencias-<#= ID #>")
.Localizable("pt-BR")
.DataKeys(keys => keys.Add(a => a.ID))
.Columns(columns =>
{
columns.Bound(ag => ag.Banco.ID);
columns.Bound(ag => ag.Codigo);
columns.Bound(ag => ag.Telefone);
columns.Command(cmd =>
{
cmd.Edit().ButtonType(GridButtonType.BareImage);
cmd.Delete().ButtonType(GridButtonType.BareImage);
});
})
.Editable(editing =>
editing.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(true))
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("AjaxSelect", "AgenciaBancaria", new { idBanco = "<#= ID #>" })
.Delete("AjaxDelete", "AgenciaBancaria")
.Update("AjaxSave", "AgenciaBancaria", new { idBanco = "<#= ID #>" })
)
.Pageable()
.Sortable()
.ToHtmlString()
)
)
... and my update controller method:
[GridAction]
[HttpPost]
public ActionResult AjaxSave(AgenciaBancaria model, long idBanco)
{
model.Banco.ID = idBanco;
Mapper.Save(model);
List<AgenciaBancaria> result = Mapper.LoadAll().Where(ag => ag.Banco.ID == idBanco).ToList();
return View(new GridModel(result));
}
Thanks!