用asp.net中的剃刀视图中的总和
我想做的是两个型号之间的总和(Razor asp.net)。 (它们是在数据库中创建的)我不想在控制器中进行操作,因为以后我希望它不修改我的值。 我需要以一种或另一种方式进行视图,要么通过删除foreach。非常感谢您,希望您的帮助。
<div class="cuartaParte">
<table style="width: 100%">
@foreach (var item in Model.PresupuestoDetalle){
<tr> //here I want to do the sum
<th scope="row" style="width: 70%; text-align: right">Descuento @[email protected]%</th>
<td>[email protected]</td>
</tr>
}
</table>
</div>
What I want to do is a sum between two Models(razor ASP.NET). (they are created in the database) I don't want to do it in the controller, because later I want it not to modify my value.
I need to do it in the view one way or another, either by taking out the forEach. Thank you very much I hope your help.
<div class="cuartaParte">
<table style="width: 100%">
@foreach (var item in Model.PresupuestoDetalle){
<tr> //here I want to do the sum
<th scope="row" style="width: 70%; text-align: right">Descuento @[email protected]%</th>
<td>[email protected]</td>
</tr>
}
</table>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果要在视图中显示两个模型之间的总和,请尝试使用
@()
外部model.cliente.cliente.descuento
和model.descuentoextraporcen%;
If you want to show the sum between two Models in the view,try to use
@()
outsideModel.Cliente.Descuento
andModel.DescuentoExtraPorcen%
;