Gunny
Gunny

Reputation: 1166

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
}

Upvotes: 0

Views: 2400

Answers (1)

Gunny
Gunny

Reputation: 1166

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.

Upvotes: 1

Related Questions