帮助在 ASP.Net MVC 2 RC 中使用 jQuery Grid 区域

发布于 2024-08-15 08:40:43 字数 429 浏览 5 评论 0原文

我关注了 Phil Haack 的jQuery Grid 在没有区域的 mvc 2 rc 项目中成功演示。现在我尝试在区域项目中实现相同的代码,但数据没有传递到网格。

演示中的 jquery grid url 属性似乎采用以下格式:

url:'/{controller}/{method}/'

我试图将区域包含在 url 属性中,但没有成功:

url:'/{area}/{controller}/{method}/'

如何使用区域从控制器中的方法检索数据?

I've followed Phil Haack's demo of jQuery Grid successfully in an mvc 2 rc project without areas. Now I'm trying to implement the same code in an areas project but the data is not being passed to the grid.

The jquery grid url property from the demo appears to be in the format of:

url:'/{controller}/{method}/'

I'm attempting to include the area in the url property without success:

url:'/{area}/{controller}/{method}/'

How do I retrieve the data from a method in controller using areas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆凄美了谁 2024-08-22 08:40:44

问题不在于 url 属性,而是我未能更改 url 中的控制器名称属性以匹配该区域中的控制器名称。

我确实发现 MVC 2 中的 json 安全性不允许 json get 请求,除非明确允许。这可以在网格操作方法的返回语句中设置:

return Json(jsonData, JsonRequestBehavior.AllowGet);

The problem wasn't with the url property but my failure to change the controller name property in the url to match the controller name in the area.

I did discover that the json security in MVC 2 doesn't allow json get requests unless explicitly allowed. This can be set in the return statement of the grid action method:

return Json(jsonData, JsonRequestBehavior.AllowGet);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文