【发布时间】:2010-11-20 01:14:03
【问题描述】:
我一直在尝试在我的 Asp.Net MVC 应用程序中实现 jQuery 的网格功能。我现在正在 XP 上测试一切,所以我启用了 mvc 扩展(因为我使用的是 IIS 5)
我遇到了 2 个问题。
- 我的 jquery 网格似乎没有被调用。
我使用 URL.Content() 方法引用了所有 jquery 和网格文件 这是我的主要内容:
我的前两个警报触发。但是一旦进入 jGrid 函数,第三个警报就不会触发。我认为它可能与 URL 有关,因为我在控制器中的函数上放置了一个断点,它永远不会被命中。
我的第二个问题是,当我将 /Bar.mvc/GridData 放在地址栏中时,为了查看它是否可以找到该功能,它会提示我使用 Firefox 的“保存文件...”下载一个 json 类型的文件。 " 对话框。
这是我在控制器中的功能:
public ActionResult GridData(string sidx, string sord, int? page, int? rows)
{
int totalPages = 1; // we'll implement later
int? pageSize = rows;
int totalRecords = 3; // implement later
var jsonData = new
{
total = totalPages,
page = page,
records = totalRecords,
rows = new[]{
new {id = 1, cell = new[] {"1", "-7", "Is this a good question?"}},
new {id = 2, cell = new[] {"2", "15", "Is this a blatant ripoff?"}},
new {id = 3, cell = new[] {"3", "23", "Why is the sky blue?"}}
}
};
return Json(jsonData);
}
【问题讨论】:
标签: jquery asp.net-mvc