I have create an MVC project that will display the details of a quotation to a table using JQuery. Below is my mark-up and the jquery itself:
- <div class="card-body text-secondary">
- <div class="table-responsive-sm">
- <table id="tblEmployee" class="table table-bordered table-hover">
- <thead>
- <tr>
- <th>Reference #th>
- <th>Damage Nameth>
- <th>Damage Conditionth>
- <th>Level Codeth>
- <th>Labot Costth>
- <th>Parts Costth>
- <th>Total Costth>
- <th>Actionth>
- tr>
- thead>
- <tbody>tbody>
- table>
- div>
- div>
- $(document).ready(function () {
- var tr;
- $.getJSON("/QuotationMgt/GetQuotationDetails", function (json) {
- $.each(json, function (i, emp) {
- var empid = emp.Id;
- tr = $('
'); - tr.append("
" + emp.Id + " "); - tr.append("
" + emp.damageName + " "); - tr.append("
" + emp.damageCondition + " "); - tr.append("
" + emp.lvlCode + " "); - tr.append("
" + emp.laborCost + " "); - tr.append("
" + emp.partsCost + " "); - tr.append("
" + emp.totalCost + " "); - tr.append("
" + " + empid + ">Delete"); - $('#tblEmployee').append(tr);
- });
- });
- $('#tblEmployee').on('click', 'td a.delete', function () {
- var deleteUrl = $(this).attr("href");
- if (confirm("Are you sure wants to delete?")) {
- $.ajax({
- url: deleteUrl, dataType: "json", type: "POST", contentType: "application/json",
- error: function (err) { alert('Unable to delete record.'); },
- success: function (response) {
- window.location.href = "/QuotationMgt/CreateQuotationDetail/" + @ViewBag.quotationNo;
- }
- });
- }
- });
- });
Below is the sample result and what I wanted is the GRAND TOTAL to be displayed at the bottom
if this is a gridview in a webform, I can simply use the RowDatabound event to get the grand total. I am just new in MVC and obviously struggling in JQuery.
Any help will be much appreciated.8 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Jes SiePosted Jul 30, 2019, 3:06 AM
Priyanka JainPosted Jul 30, 2019, 1:21 AM
Jes SiePosted Jul 29, 2019, 11:09 PM
Jignesh KumarPosted Jul 29, 2019, 8:14 PM
Priyanka JainPosted Jul 29, 2019, 10:06 AM
Rajanikant HawaldarPosted Jul 29, 2019, 12:13 AM
Jes SiePosted Jul 28, 2019, 11:50 PM
Rajanikant HawaldarPosted Jul 28, 2019, 11:41 PM