Nov 07, 2018 03:11 AM|daleman|LINK
I'm very exciting to use datatable with checkbox from
this example for bulk approval.
What I'm facing, right now, are
this my view code
var dataToPost = $('#frm_Approval').serialize(); alert(dataToPost); $.post("Payment_Approval", dataToPost) .done(function (data) { })
Please advise me.
Contributor
3491 Points
Nov 07, 2018 05:43 AM|DA924|LINK
You should use Ajax and use a service.
The service can be accessible via Ajax that calls a post method on the MVC controller action that in turn call a service for data persistence like the service using a stored procedure.
Contributor
3080 Points
Nov 08, 2018 09:14 AM|Yuki Tao|LINK
Hi daleman,
I think you could use model bind to pass all the checked some IDs to Controller.
For example:
Model:
public class CheckboxViewModel { ... public IList<SelectListItem> Carrier { get; set; }//define data source of listbox public List<string> SelectedCarrierId { get; set; } }
View:
@model xxx.CheckboxViewModel ... @Html.ListBoxFor(model => model.SelectedCarrierId, Model.Carrier, new { @Send</button> ...
Here is the demo,you could refer to:
Best Regards.
Yuki Tao
All-Star
51674 Points
Nov 08, 2018 04:09 PM|bruce (sqlwork.com)|LINK
serialize() will only included checkboxes that are enabled and checked. but if you used checkbox() instead of html <input>, the checkbox helper creates a hidden field for each <input> (to post false). so to keep the list small, just use <input type=checkbox>
3 replies
Last post Nov 08, 2018 04:09 PM by bruce (sqlwork.com)