Reputation: 3505
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 });
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
Upvotes: 0
Views: 1831
Reputation: 11
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;
Upvotes: 1
Reputation: 30671
You can try this:
public ActionResult GetTList(string ItemsArr)
{
string [] items = ItemsArr.Split(',');
}
Upvotes: 1