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 = "width:200px;" })

<input name="name" class="txt" id="name" style="width: 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>

posted @ 2015-05-28 11:14  小-牛  阅读(551)  评论(0编辑  收藏  举报