[英]FireFox Removes My Trailing '0'
我有一個網頁,在某些字段中顯示存儲在服務器上的值,但如果其他值以“ 0”或“ .00”結尾,則會將其刪除,因此£1.10將是£1.1,£10.00將是£10。
在我的代碼中,我將它們表示為Decimals
因此我希望它能顯示整個值。 如果我使用Chrome或IE,對我來說效果很好,那么我的問題就在FF上。
在我看來
<%
Decimal sum = 0;
Decimal totalTrancheValues = 0;
var isCappeddrawdown = false;
foreach (var tranche in benefitDetails.Tranches)
{
//Adds all remaining incomes for 'Capped drawdown' and give a total for them all
if (tranche.FundType == "Capped drawdown")
{
sum = sum + Convert.ToDecimal(tranche.GrossIncomeRemainingThisPensionYear == null ? 0 : tranche.GrossIncomeRemainingThisPensionYear);
isCappeddrawdown = true;
}
//Adds totals for all tranches
totalTrancheValues = totalTrancheValues + Convert.ToDecimal(tranche.Value == null ? 0 : tranche.Value);
}
%>
<div class="form-group">
<label class="col-sm-offset-1 col-sm-4 control-label">SIPP cash balance</label>
<div class="col-sm-4">
<input id="SIPPCashBalance_Textbox" name"SIPPCashBalance_Textbox" value=<%: Math.Round(client.Sipp.Cash, 2) %> disabled />
</div>
</div>
<% if (isCappeddrawdown)
{%>
<div class="form-group">
<label class="col-sm-offset-1 col-sm-4 control-label">Remaining income</label>
<div class="col-sm-4">
<input id="RemainingIncome_Textbox" name="RemainingIncome_Textbox" value=<%: sum %> disabled />
</div>
</div>
<%} %>
我嘗試將convert.todecimal
包裹在我的“和”周圍,但無法正常工作
當我使用F12時,它說我的值是value="30.00"
但在我的網頁上它只顯示為30
我嘗試將其用作string
,並嘗試使用string.Format("{0:C}", sum)
和sum.toString()
但我的字段僅不顯示'.00'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.