Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using (Html.BeginForm("SubmitSelected", "Costumer", FormMethod.Post, new { id = "form-Costumer", enctype = "multipart/form-data", name = "myform" }))
- {
- <input type="checkbox" id="checkall" /><span>Check All</span>
- <div id="checkboxes">
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>
- Select //this is from the class where datatype is bool
- </th>
- <th>
- ContactNumber
- </th>
- <th>
- ConsumerName
- </th>
- </tr>
- </thead>
- @Html.EditorFor(model => model.transaksiSelectionViewModel.Transactions)
- </table>
- </div>
- <div class="form-group">
- @Html.Label("Total Checked")
- <div class="col-sm-10">
- <input type="text" id="total" class="form-control" />//the result of the number checked here
- </div>
- </div>
- }
- @section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
- <script type="text/javascript">
- function toggleChecked(status) {
- $("#checkboxes input").each(function () {
- // Set the checked status of each to match the
- // checked status of the check all checkbox:
- $(this).prop("checked", status);
- });
- }
- $(document).ready(function () {
- //Set the default value of the global checkbox to true:
- $("#checkall").prop('checked', false);
- // Attach the call to toggleChecked to the
- // click event of the global checkbox:
- $("#checkall").click(function () {
- var status = $("#checkall").prop('checked');
- toggleChecked(status);
- });
- });
- </script>
- }
Add Comment
Please, Sign In to add comment