从html页面中的类获取数据时,输入字符串格式不正确
本文关键字:输入 字符串 不正确 格式 数据 获取 html | 更新日期: 2023-09-27 18:06:46
BorrowerInfoFullDetails.cs
public class BorrowerInfoFullDetails
{
public decimal TotalLoanAmount { get; set; }
}
Borrower.aspx.cs
namespace MFCloudAspx
{
public partial class Borrower : System.Web.UI.Page
{
public BorrowerInfoFullDetails objBorrowerInfoFullDetails;
protected void Page_Load(object sender, EventArgs e)
{
objBorrowerInfoFullDetails = new BorrowerInfoFullDetails();
objBorrowerInfoFullDetails.TotalLoanAmount = 25000;
}
}
}
Borrower.aspx
<div class="col-sm-6">
<h2>Rs.
<%=string.Format("{0,N}",objBorrowerInfoFullDetails.TotalLoanAmount) %></h2>
<h3><i class="glyphicon glyphicon glyphicon-hand-up"></i>
<br>
Loan Amount</h3>
</div>
误差& lt; % = string.Format("{0,N}",objBorrowerInfoFullDetails.TotalLoanAmount) %>输入字符串格式不正确。I Want value print value 25000
你需要冒号而不是逗号。试试这个:-
<%=string.Format("{0:N}",objBorrowerInfoFullDetails.TotalLoanAmount) %></h2>
检查格式化数字字段列表