@Html.RadioButton("div3r1",0, Model2.div3r1.Contains("0"))
<input id="div3r1" name="div3r1" type="radio" value="0" /> <!-- 當Model2.div3r1.Contains("0")爲false --> <input checked="checked" id="div3r1" name="div3r1" type="radio" value="0" />
@Html.Encode()
@Html.ActionLink()
通過 MVC,Html.ActionLink() 不連接到視圖。它創建控制器操作(controller action)的連接。
@Html.ActionLink("About this Website", "About")
輸出html: <a href="/Home/About">About this Website</a>
HTML 表單元素
以下 HTML 幫助器可用於呈現(修改和輸出)HTML 表單元素:
BeginForm()
@using (Html.BeginForm("ExcelInSave", "controller", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
<input type="submit" value="導入" />
}
後臺參數傳入| (HttpPostedFileBase file)
EndForm()TextArea()
TextBox()
CheckBox()
RadioButton()
ListBox()
DropDownList()
Hidden()
Password()