Guest User

Untitled

a guest
Jan 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. @using (Html.BeginForm("SubmitSelected", "Costumer", FormMethod.Post, new { id = "form-Costumer", enctype = "multipart/form-data", name = "myform" }))
  2. {
  3. <input type="checkbox" id="checkall" /><span>Check All</span>
  4. <div id="checkboxes">
  5. <table class="table table-bordered">
  6. <thead>
  7. <tr>
  8. <th>
  9. Select //this is from the class where datatype is bool
  10. </th>
  11.  
  12. <th>
  13. ContactNumber
  14. </th>
  15. <th>
  16. ConsumerName
  17. </th>
  18. </tr>
  19. </thead>
  20. @Html.EditorFor(model => model.transaksiSelectionViewModel.Transactions)
  21. </table>
  22. </div>
  23. <div class="form-group">
  24. @Html.Label("Total Checked")
  25. <div class="col-sm-10">
  26. <input type="text" id="total" class="form-control" />//the result of the number checked here
  27.  
  28. </div>
  29. </div>
  30.  
  31.  
  32. }
  33. @section Scripts {
  34. @Scripts.Render("~/bundles/jqueryval")
  35. <script type="text/javascript">
  36. function toggleChecked(status) {
  37. $("#checkboxes input").each(function () {
  38.  
  39. // Set the checked status of each to match the
  40. // checked status of the check all checkbox:
  41. $(this).prop("checked", status);
  42. });
  43. }
  44.  
  45. $(document).ready(function () {
  46.  
  47. //Set the default value of the global checkbox to true:
  48. $("#checkall").prop('checked', false);
  49.  
  50. // Attach the call to toggleChecked to the
  51. // click event of the global checkbox:
  52. $("#checkall").click(function () {
  53. var status = $("#checkall").prop('checked');
  54. toggleChecked(status);
  55. });
  56. });
  57.  
  58. </script>
  59. }
Add Comment
Please, Sign In to add comment