我正在使用telerik mvc 3。
我有一个绑定到ViewModel的Grid。
@(Html.Telerik().Grid<SampleProject.ViewModels.Location.RoomViewModel>()
.Name("Grid")
.ToolBar(cmd => cmd.Insert())
.DataKeys(keys => keys.Add(c => c.RoomId))
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("Selecting", "Location")
.Insert("Inserting", "Location")
.Update("Updating", "Location")
.Delete("Deleting", "Location" )
)
.Columns(c =>
{
c.Bound(o => o.RoomName);
c.Bound(o => o.MaxSeats);
c.Bound(o => o.HasScanner);
c.Bound(o => o.HasPrinter);
c.Bound(o => o.HasFlipchart);
c.Bound(o => o.HasBeamer);
c.Command(cmd =>
{
cmd.Edit();
cmd.Delete();
});
})
)
“插入”-method工作正常(我将RoomViewModel作为参数)。 “选择”-Method也有效,但“删除”-Method不起作用。
#region GridActions
[GridAction]
public ActionResult Selecting()
{
return View(new GridModel(this._currentLocation.Rooms));
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult Inserting(RoomViewModel rvm)
{
this._currentLocation.Rooms.Add(rvm);
return View(new GridModel(this._currentLocation.Rooms));
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult Deleting(RoomViewModel rvm)
{
this._currentLocation.Rooms.Remove(rvm);
return View(new GridModel(this._currentLocation.Rooms));
}
我也试过了:
public ActionResult Deleting(int rvm) --> internal error 500 - doesnt hit the breakpoint
public ActionResult Deleting(string rvm)
public ActionResult Deleting(object rvm)
总是“空”,任何想法???
答案 0 :(得分:0)
实际上,删除操作方法需要将实体标识作为参数:
public ActionResult _DeleteAjaxEditing(int id)