嗨我有数组值,我需要将它作为参数传递给客户端的telerik mvc grid rebind。我的代码:
var arr = new Array();
arr.push("one"); arr.push("two");
var grid = $('#TreeTermGrid').data('tGrid');
grid.rebind({ItemsArr: arr });
控制器方法:
public ActionResult GetTList(List<string> ItemsArr)
{
//but i got one element with data "one,two"
}
怎么做对吗? 非常感谢
答案 0 :(得分:1)
你可以试试这个:
public ActionResult GetTList(string ItemsArr)
{
string [] items = ItemsArr.Split(',');
}
答案 1 :(得分:1)
为了使数组的结果与ASP.NET MVC中的绑定机制兼容,我们需要使用$ .ajax()中的“传统”设置。重新绑定函数使用$ .ajax()来调用控制器,你可以尝试这个来全局启用'传统':
$.ajaxSettings.traditional = true;