@foreach (var item in Model)
{
if (item != null)
{
<tr name="detailRow">
<td>
<span>@Html.DisplayFor(modelItem => item.material_g_serial)</span>
</td>
<td>
@Html.DropDownListFor(modelItem => item.material_g_id, @ViewData["goods_id"] as SelectList, "选择商品", new { onchange = "goodsListChange(this)", baseval = item.material_g_id })
</td>
<td>
<span>@Html.DisplayFor(modelItem => item.meterial_g_comment)</span>
</td>
<td>
@Html.TextBoxFor(modelItem => item.number.ToString("N"), new { type = "number", min = "1" })
</td>
<td>
<a name="deletelink" id="@item.material_g_id" onclick="deleteRow(this);">删除</a>
</td>
</tr>
}
}
可以这样写吗?我记得不行吧。你在number字段上加个format标签吧
刚搜了下:@Html.TextBoxFor(model => model.StartDate, new { Value = Model.StartDate.ToString("yyyy-MM-dd")})可以试下这种写法。自定义value值
谢谢,
TextBoxFor有个重载可以指定格式化字符串的
@Html.TextBoxFor(m=>m.Number,"{0:N}")
--
PS 如果可以的话,C#的属性请尽量大写
@Html.TextBoxFor(m => m.Number, "{0:N}", new { type = "number", min = 1 })