我有一个不同数字的表,我想每3个数字放一个空格。
例如:1500 = 1 500或10000 = 10 000
我的代码:
<div class="table-responsive" style="padding-top:30px;">
<table class="table table-bordered">
<thead>
<tr>
@foreach (string row in ViewBag.ListEntete)
{
<th>@row</th>
}
</tr>
</thead>
<tbody>
@{
List<List<string>> listHisto = ViewBag.ListHisto;
bool isClassSuccess = true;
string classLigne;
foreach (List<string> item in listHisto)
{
if (isClassSuccess)
{
classLigne = "class=warning";//jaune clair
isClassSuccess = false;
}
else
{
classLigne = "class=success";//vert clair
isClassSuccess = true;
}
@:<tr @classLigne>
foreach (string row in item)
{
<td>@row</td>
}
@:</tr>
}
@:<tr class="active">
<td>CUMUL</td>
foreach (string row in ViewBag.ListCumul)
{
<td>@row</td>
}
@:</tr>
}
</tbody>
</table>
我的号码在列表中。
dac = new SqlDataAdapter(sql, cn);
dsc = new DataSet();
dac.Fill(dsc, "histo");
List<List<string>> listHisto = new List<List<string>>();
foreach (DataRow row in dsc.Tables["histo"].Rows)
{
List<string> listRow = new List<string>();
listRow.Add(row["ENTITE"].ToString());
listRow.Add(row["M01"].ToString());
listRow.Add(row["M02"].ToString());
listRow.Add(row["M03"].ToString());
listRow.Add(row["M04"].ToString());
listRow.Add(row["M05"].ToString());
listRow.Add(row["M06"].ToString());
listRow.Add(row["M07"].ToString());
listRow.Add(row["M08"].ToString());
listRow.Add(row["M09"].ToString());
listRow.Add(row["M10"].ToString());
listRow.Add(row["M11"].ToString());
listRow.Add(row["M12"].ToString());
listRow.Add(row["TT"].ToString());
listHisto.Add(listRow);
}
list.Add("histo", listHisto);
我尝试按row["M09"].ToString()
更改row["M09"].ToString("n", nfi)
但我有这个错误:
提前感谢您的帮助