This question is locked. New answers and comments are not allowed.
Hi,
I have a view strongly typed to a viewmodel. This model has a Loan object which in turn has a list of LoanEvents. The view displays information about the Loan and a grid of LoanEvents. When binding I have managed to insert new LoanEvents but cannot get the edit/update part to work.
Here is my code:
When pushing the edit button in the grid the Details action in the LoanController is fired, with the LoanEvents id as parameter. Which of course breaks as the Loan's Id doesn't correspond to the LoanEvent's Id.
What is needed? Will the action of the Select binding always fire?
Best regards
PÃ¥l Eilertsen
I have a view strongly typed to a viewmodel. This model has a Loan object which in turn has a list of LoanEvents. The view displays information about the Loan and a grid of LoanEvents. When binding I have managed to insert new LoanEvents but cannot get the edit/update part to work.
Here is my code:
<%: Html.Telerik().Grid(Model.Loan.LoanEvents)
.Name("LoanEvents")
.DataKeys(keys => keys.Add(le => le.ID))
.ToolBar(commands => commands.Insert())
.DataBinding(databinding => databinding.Server()
.Select("Details", "Loan", new {id = Model.Loan.ID})
.Insert("CreateEvent", "Loan", new { id = Model.Loan.ID })
.Update("Edit", "LoanEvent")
.Delete("Delete", "LoanEvent"))
.Columns(columns =>
{
columns.Bound(p => p.Created);
columns.Bound(p => p.Action).Width(130).Title("Type");
columns.Bound(p => p.Comment).Width(300).Title("Kommentar");
columns.Bound(p => p.Officer.FullName).Width(130).Title("RÃ¥dgiver");
columns.Command(commands => commands.Edit()).Width(180).Title("");
})
.Editable(editing => editing.Mode(GridEditMode.InLine))
.Pageable(paging => paging.PageSize(10))
.Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(le => le.Created).Descending()))
.Filterable()
%>
When pushing the edit button in the grid the Details action in the LoanController is fired, with the LoanEvents id as parameter. Which of course breaks as the Loan's Id doesn't correspond to the LoanEvent's Id.
What is needed? Will the action of the Select binding always fire?
Best regards
PÃ¥l Eilertsen