Passing selected row IDs from jqGrid to ASP.Net MVC Controller Action
I have cascading jqGrids (State, then City, then Zipcode) on a View with multirow on. I can select one or more of the ID values for the zip code by grabbing data using the following:
var s;
s = jQuery("#zipList")开发者_开发百科.jqGrid('getGridParam', 'selarrrow');
"s" ends up containing something that looks like "23,119,5932,44". I am trying to pass that string (or a collection containing those items) to a Controller action that looks something like (so I can do something to each selected zip):
public ActionResult ProcessZips(string selectedZips)
{
// do something
}
or
public ActionResult ProcessZips(List<string> selectedZips)
{
// do something
}
It's goofy, but I'm have it working by using OnSelectRow and OnSelectAll to update a hidden field in my form with the selected ID values. I can easily grab that in the form submission using the BeginForm helper.
精彩评论