Telerik Grid: Issue with Select
I have the following databinding. The actual URL assigned to my Edit button and Select button is : /Home/Selection/
. I do not think that this should be the case.
Why does the action for my select button get assigned to my edit button also. They both have /Home/Selection
for the Controller/Action
My Delete button has the correct action called delete. /Home/Delete/
based on the binding definition below.
See databind below, The databinding binds an action called "Selection" and controller
called Home
. I wou开发者_运维百科ld think that it would call ~/Home/Selection/5?
I get a 404 not found error when clicking the select button. Any help is appreciated.
- Why am I getting 404 error.
- why does the edit and select button have the same action assigned?
public ActionResult Index()
{
ProjectViewModel objProjectViewModel = new ProjectViewModel();
objProjectViewModel.ProjectList = Repository.GetProjects();
return View(objProjectViewModel);
}
[HttpPost]
[GridAction]
public ActionResult Selection(long id)
{
ProjectViewModel objProjectViewModel = new ProjectViewModel();
objProjectViewModel.ProjectHierarchy = Repository.GetProjects(id);
ViewBag["id"] = id;
return View(objProjectViewModel);
}
DATABINDING
.DataBinding(dataBinding => dataBinding.Server().Select("Selection", "Home")
.Insert("Insert", "Home")
.Update("Update", "Home")
.Delete("Delete", "Home")
)
Do you have a DataKey set on the Grid?
Html.Telerik().Grid(...)
.DataKeys(dataKeys => dataKeys.Add(o => o.Id))
Here is what telerik support said:
This is by design. The grid uses a query string argument to determine that it is in edit mode. You can see this in our online demo. http://demos.telerik.com/aspnet-mvc/Grid/EditingServerSide/1?mode=InLine&type=Text&Grid-mode=edit
the Telerik team
精彩评论