Telerik Grid:选择问题
我有以下数据绑定。分配给我的“编辑”按钮和“选择”按钮的实际 URL 是:/Home/Selection/
。我认为情况不应该如此。 为什么我的选择按钮的操作也分配给我的编辑按钮。它们都有用于 Controller/Action
的 /Home/Selection
我的删除按钮具有称为删除的正确操作。 /Home/Delete/
基于下面的绑定定义。
请参阅下面的数据绑定,数据绑定绑定名为“Selection”的操作和名为Home
的控制器
。我认为它会调用 ~/Home/Selection/5?
当单击选择按钮时,我收到 404 not found 错误。任何帮助表示赞赏。
- 为什么我收到 404 错误。
- 为什么编辑和选择按钮分配了相同的操作?
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.Server().Select("Selection", "Home")
.Insert("Insert", "Home")
.Update("Update", "Home")
.Delete("Delete", "Home")
)
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 would 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")
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您在 Grid 上设置了 DataKey 吗?
Do you have a DataKey set on the Grid?
以下是 Telerik 支持人员的说法:
这是设计使然。网格使用查询字符串参数来确定它是否处于编辑模式。您可以在我们的在线演示中看到这一点。
http://demos .telerik.com/aspnet-mvc/Grid/EditingServerSide/1?mode=InLine&type=Text&Grid-mode=edit
Telerik 团队
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