Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
SUMA de los valores de las celdas de la tabla y muestra el total en el extremo inferior

Soy nuevo en ASP.NET y sigo aprendiendo haciendo autoestudios. Entonces, en mi aplicación ASP.NET MVC en la vista, hay tablas en las que cargo los datos y muestro al usuario. Aquí quiero mostrar el valor Total al final de la celda de sum los datos de la columna Invoice Amount . El tipo de datos es decimal . Estoy luchando por hacerlo porque todavía no soy bueno en javascript. Entonces, ¿puedo obtener ayuda aquí? Gracias.

Esta es mi mesa

 <table class="table"> <tr> <th> Inoice Number </th> <th> Invoice Amount </th> <th> Attachment </th> <th></th> </tr> @foreach (var item in Model.PaybillInvoiceDetailsList) { <tr> <td> @Html.DisplayFor(modelItem => item.Invoice_No) </td> <td> @Html.DisplayFor(modelItem => item.Invoice_Amount) </td> <td> <a href="@Url.Action(" RetrieveImagePbI", new { id=item.Id })" target="_blank" rel="noreferrer noopener"> <img width="100" height="100" border="0" class="m1-1" align="center" src="@Url.Action(" RetrieveImagePbI", new { id=item.Id })" /> </a> </td> </tr> } </table>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Simplemente puede usar @Model.PaybillInvoiceDetailsList.Sum(i => i. Invoice_Amount).ToString("0.##")

Los cambios completos pueden ser

 <table class="table"> <tr> <th> Inoice Number </th> <th> Invoice Amount </th> <th> Attachment </th> <th></th> </tr> @foreach (var item in Model.PaybillInvoiceDetailsList) { <tr> <td> @Html.DisplayFor(modelItem => item.Invoice_No) </td> <td> @Html.DisplayFor(modelItem => item.Invoice_Amount) </td> <td> <a href="@Url.Action(" RetrieveImagePbI", new { id=item.Id })" target="_blank" rel="noreferrer noopener"> <img width="100" height="100" border="0" class="m1-1" align="center" src="@Url.Action(" RetrieveImagePbI", new { id=item.Id })" /> </a> </td> </tr> } <tr> <td colspan"3">Total</td> <td>@Model.PaybillInvoiceDetailsList.Sum(i => i.Invoice_Amount).ToString("0.##")</td> </tr> </table>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda