【发布时间】:2016-04-14 15:06:15
【问题描述】:
我正在开发 MVC 网络应用程序,有一个模型类 student.cs
具有属性名称、地址、点,其中点是整数。鉴于我正在尝试使用:
<%=Html.TextBoxFor(model => model.points) %>
编译器无法接受。 如何将 Html.TextBoxFor 用于整数?
【问题讨论】:
-
你得到什么错误?
-
System.FormatException:输入字符串的格式不正确。当我尝试转换它时,BANGG –
-
可以展示模型类吗?
-
public class Student { public Student() { } //构造函数:) public Student(int ID, int repPoints) { this.ID = ID; this.repPoints = repPoints; } 公共 int ID { 获取;放; } 公共 int repPoints { 获取;放; } }
-
我还有很多其他属性
标签: c# html asp.net-mvc