首页 新闻 搜索 专区 学院

截取字符串Decimal.ToString("N")后无法跳转到此网页

0
悬赏园豆:50 [已解决问题] 解决于 2015-12-31 18:15

@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>
                        }
                    }

James.CGM的主页 James.CGM | 初学一级 | 园豆:73
提问于:2015-12-31 16:55
< >
分享
最佳答案
1

可以这样写吗?我记得不行吧。你在number字段上加个format标签吧

 

刚搜了下:@Html.TextBoxFor(model => model.StartDate, new { Value = Model.StartDate.ToString("yyyy-MM-dd")})可以试下这种写法。自定义value值

收获园豆:50
起个名字 | 菜鸟二级 |园豆:377 | 2015-12-31 17:39

谢谢,

James.CGM | 园豆:73 (初学一级) | 2015-12-31 18:15
其他回答(1)
0

TextBoxFor有个重载可以指定格式化字符串的

@Html.TextBoxFor(m=>m.Number,"{0:N}")

--

PS 如果可以的话,C#的属性请尽量大写

~洛书~ | 园豆:333 (菜鸟二级) | 2016-01-08 10:07

@Html.TextBoxFor(m => m.Number, "{0:N}", new { type = "number", min = 1 })

支持(0) 反对(0) ~洛书~ | 园豆:333 (菜鸟二级) | 2016-01-08 10:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册