MVC-Html.Label(TextBox、TextArea、RadioButton、CheckBox)

红色表示可选参数。

@Html.Label("name", "value", new { @class = "class", @style = "color:Red;" })

<label class="class" style="color: red;" for="name">value</label>

@Html.TextBox("name", "value", new { @class = "txt", @style = "200px;" })

<input name="name" class="txt" id="name" style=" 200px;" type="text" value="value"></input>

@Html.TextArea("name", "value", new { @class = "txt", @rows = "4", @cols = "10" })

<textarea name="name" class="txt" id="name" rows="4" cols="10">value</textarea>

@Html.RadioButton("name", "value1", true, new { @class = "xx" })        

@Html.RadioButton("name", "value2")
<input name="name" class="xx" id="name" type="radio" checked="checked" value="value1"></input>
<input name="name" id="name" type="radio" value="value2"></input>

@Html.CheckBox("name", true, new { @class = "cc" })
<input name="name" class="cc" id="name" type="checkbox" checked="checked" value="true"></input>
<input name="name" type="hidden" value="false"></input>

原文地址:https://www.cnblogs.com/yaosuc/p/4535383.html