开发者

telerik mvc grid rebind pass array

开发者 https://www.devze.com 2023-02-11 13:40 出处:网络
Hi i have array of values and i need to pass it as argument for telerik mvc grid rebind in client side. My code:

Hi i have array of values and i need to pass it as argument for telerik mvc grid rebind in client side. My code:

var arr = new Array();
arr.push("one");  arr.push("two");      
var grid = $('#TreeTermGrid').data('tGrid');
grid.rebind({ItemsArr: arr }开发者_如何学Python);

Controller method:

public ActionResult GetTList(List<string> ItemsArr)
{        
//but i got one element with data "one,two"
}

How can do it correct? Thanks a lot


You can try this:

public ActionResult GetTList(string ItemsArr)
{        
    string [] items = ItemsArr.Split(',');
}


In order to make the results of the array compatible with the binding mechanism in ASP.NET MVC, we need to use the ‘traditional’ setting in $.ajax(). The rebind function using $.ajax() to call the controller and you could try this to enable ‘traditional’ globally:

$.ajaxSettings.traditional = true;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号