Hi,
I'm trying to implement a custom command on my grid, which is using server binding, but the button just leads to a 'resource not found' error. My routing looks as it should and I can't see anything else wrong. I should also say that the MVC stuff is actually implemented in an 'area'. All my code is below, could anyone help?
Routing
1.
context.MapRoute(
2.
"ControlPanel_default"
,
3.
"ControlPanel/{controller}/{action}/{id}"
,
4.
new
{ action =
"Index"
, id = UrlParameter.Optional }
5.
);
Index.cshtml
01.
@(Html.Kendo().Grid(Model)
02.
.Name(
"Grid"
)
03.
.Columns(col =>
04.
{
05.
col.Bound(p => p.CustomerId);
06.
col.Bound(p => p.aspNetUserID);
07.
col.Command(cmd =>
08.
{
09.
cmd.Edit();
10.
cmd.Custom(
"Test"
).Action(
"Lockout"
,
"Index"
);
11.
});
12.
})
13.
.Editable(edt => edt.Mode(GridEditMode.PopUp))
14.
.Pageable()
15.
.Sortable()
16.
.Scrollable()
17.
.DataSource(ds => ds
18.
.Server()
19.
.Model(mdl => mdl.Id(p => p.CustomerId))
20.
.Read(
"Index"
,
"Index"
)
21.
.Update(
"Update"
,
"Index"
)
22.
.Create(
"Create"
,
"Index"
)
23.
.Destroy(
"Destroy"
,
"Index"
))
24.
)
IndexController.cs
01.
public
class
IndexController : Controller
02.
{
03.
public
ActionResult Index()
04.
{
05.
ViewBag.Title =
"Home"
;
06.
return
View(GetCustomers());
07.
}
08.
public
ActionResult Lockout(
int
CustomerId)
09.
{
10.
if
(ModelState.IsValid)
11.
{
12.
//var result = CustomerId;
13.
RouteValueDictionary routeValues =
this
.GridRouteValues();
14.
return
RedirectToAction(
"Index"
, routeValues);
15.
}
16.
return
View(
"Index"
);
17.
}
18.
}