我想提出一個登記表,我的網站,目前我有像這樣 和代碼是內部的一個標題:ASP MVC添加TextBoxFor()
@Html.Label("Firstname")
@Html.TextBoxFor(model => model.Firstname, new {@required = "require", @style = "width:75%;", @class = "form-control" })
@Html.ValidationMessageFor(model => model.Firstname, null, new { @style = "color:red;" })
<br />
@Html.Label("Surname")
@Html.TextBoxFor(model => model.Lastname, new { @required = "require", @style = "width:75%;", @class = "form-control" })
@Html.ValidationMessageFor(model => model.Lastname, null, new { @style = "color:red;" })
<br /> . . .
我是什麼試圖做的是添加標題,例如「名」文本框裏面,輸入數據時,它會消失,看起來像這樣
我曾嘗試加入:
@name ="FirstName"
@label ="FirstName"
@title ="FirstName"
但所有這些沒有做任何事。
你試過'@value =「姓」'? –