I have a grid under foreach statement. This foreach statement has an HTML input checkbox column.
My problem is, I am able to populate my rows and grid properly. All input fields are okay even the checkbox attributes were okay but I cannot get all the "checked" checkbox to pass into the controller as Model.
Here is my HTML/View code:
<input type="checkbox" class="chkEmployee" name="lngEmployeeID" value="="@Model.lngEmployeeID"></input>
And this is my JQuery code:
function fncBulkApprove() {
$('#btnEdit').unbind();
$('#btnEdit').on('click', function(e) {
e.preventDefault();
var objData = $('form').serialize();
$.ajax({
url: '@Url.Action("fncBulkEdit", Model)',
type: 'POST',
datatype: 'application/JSON',
data: objData,
beforeSend: function () {
},
complete: function (request, status) {
},
success: function (result) {
$('#divEdit').dialog('open');
},
error: function (request, status, error) {
}
});
});
}
On my controller, I am passing my Model as parameter:
[HttpPost]
public PartialViewResult fncBulkEdit(entEmployee objModel)
{
return PartialView("_Edit");
}
The list of IDs on the model are declared under:
public virtual IList<long> lngEmployeeID { get; set; }
How will I am able to pass all checked checkboxes as IList IDs to my controller?
Aucun commentaire:
Enregistrer un commentaire