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 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Priyanka JainRank #356 · 7K reputationPosted Jul 29, 2019, 6:06 AM EDT
Rajanikant HawaldarRank #108 · 20.5K reputationPosted Jul 28, 2019, 7:41 PM EDT
Jes SieRank #1,285 · 1.3K reputationPosted Jul 28, 2019, 7:50 PM EDT
Rajanikant HawaldarRank #108 · 20.5K reputationPosted Jul 28, 2019, 8:13 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Jul 29, 2019, 4:14 PM EDT
Jes SieRank #1,285 · 1.3K reputationPosted Jul 29, 2019, 7:09 PM EDT
Priyanka JainRank #356 · 7K reputationPosted Jul 29, 2019, 9:21 PM EDT
Jes SieRank #1,285 · 1.3K reputationPosted Jul 29, 2019, 11:06 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts