I have a bit of a problem that's been driving me batty.
I have a page which generates a list of checkboxes based on a search. Also within the page is a dialog box designed to show up when a button is pressed. What I'm trying to do is get values from the checkboxes and pass them to a controller action which then returns the partial for the dialog.
The trouble I'm having is that I'm getting the values from the checkboxes but they're not passing to the action in the controller. Not sure what I'm missing here.
The jquery script I'm using
var create_dialog = jQuery("#main div#list_dialog");
// AddToList is a button for sending values to the action
$("#AddToList").live("click", function() {
var myData = new Array();
var i = 0;
$("input:checkbox[@name='ID']").each(
function() {
if (this.checked) {
myData[i] = this.value;
i++;
}
});
create_dialog.load(
Jurat.Path.createActionPath("List", "ListValues"),
{ ID: myData },
function() {
create_dialog.dialog("open");
create_dialog.find("form").validate();
});
});
The Controller Action
[HttpPost]
public ActionResult ListValues(string ID)
{
// Removed manipulation details
return PartialView("ListSelection", Data);
}