This question is locked. New answers and comments are not allowed.
Hi,
I have following in view.
And controller
with add new records,InsertParentGuardian is never called. If I type it in address bar it looks fine. But clicking Add new records add an inline row in the grid without calling Action method(I used breakpoint to verify). All other GridActions are called without problem(i.e. save, delete) Would be very grateful if anyone could help me. Thanks
I have following in view.
@( Html.Telerik().Grid<
SMS.Models.Student.StudenRelativeGridItemViewModel
>()
.Name("GridRelations")
.ToolBar(commands => { commands.Insert().ButtonType(GridButtonType.Image);
commands.SubmitChanges().ButtonType(GridButtonType.Image);
})
.DataKeys(keys =>
{
keys.Add(p => p.RelativeID).RouteKey("id");
keys.Add(p => p.StudentID).RouteKey("studentid");
})
.Columns(columns =>
{
columns.Bound(o => o.FirstName).Width(120).ReadOnly();
columns.Bound(o => o.LastName).Width(120);
columns.Bound(o => o.Relation).Width(80);
columns.Bound(o => o.EmailAddress).Width(100).Title("Email");
columns.Bound(o => o.HomeNumber).Width(100);
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.ImageAndText);
commands.Delete().ButtonType(GridButtonType.ImageAndText);
}).Width(180).Title("Commands");
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("_GetStudentRelatives", "Students", new
{
})
.Update("SaveStudentRelations", "Students")
.Delete("DeleteParentGuardian", "Students")
.Insert("InsertStudentRelations", "Students")
)
.Scrollable(scrolling => scrolling.Enabled(true))
.Sortable(sorting => sorting.Enabled(true))
.Pageable(paging => paging.Enabled(true))
.Filterable(filtering => filtering.Enabled(true))
.Groupable(grouping => grouping.Enabled(true))
.Editable(editable=> editable.Mode(GridEditMode.InCell))
.Footer(true)
)
private
GridModel gridStudentRelatives(
int
studentid)
{
var query = _gridstudenRelationViewModelBuilder.Build(studentid);
return
new
GridModel(query);
}
[GridAction]
public
ActionResult DeleteParentGuardian(
int
studentid,
int
id)
{
_studentRelativeService.DeleteRelative(id);
return
View(gridStudentRelatives(studentid));
}
[GridAction]
public
ActionResult SaveStudentRelations(
int
studentid,
int
id)
{
_studentRelativeService.SaveRelative(id);
return
View(gridStudentRelatives(studentid));
}
[GridAction]
public
ActionResult InsertParentGuardian(
int
studentid,
int
id)
{
_studentRelativeService.InsertRelative(id);
return
View(gridStudentRelatives(studentid));
}
with add new records,InsertParentGuardian is never called. If I type it in address bar it looks fine. But clicking Add new records add an inline row in the grid without calling Action method(I used breakpoint to verify). All other GridActions are called without problem(i.e. save, delete) Would be very grateful if anyone could help me. Thanks