HTML helpers en razor

https://www.tutorialsteacher.com/mvc/html-helpers

@Html.TextBox("StudentName", null, new { @class = "form-control" })  

<input class="form-control"
id="StudentName"
name="StudentName"
type="text"
value="" />

@Html.TextBoxFor(m => m.StudentName, new { @class = "form-control" })  
<input class="form-control" 
        id="StudentName" 
        name="StudentName" 
        type="text" 
        value="John" />


@Html.CheckBox("isNewlyEnrolled", true)


<input checked="checked" 
        id="isNewlyEnrolled" 
        name="isNewlyEnrolled" 
        type="checkbox" 
        value="true" />

Male:   @Html.RadioButton("Gender","Male")  
Female: @Html.RadioButton("Gender","Female")  

Male: <input checked="checked" 
        id="Gender" 
        name="Gender" 
        type="radio" 
        value="Male" />

Female: <input id="Gender" 
        name="Gender" 
        type="radio" 
        value="Female" />

@Html.DropDownList("StudentGender", 
                    new SelectList(Enum.GetValues(typeof(Gender))),
                    "Select Gender",
                    new { @class = "form-control" })

<select class="form-control" id="StudentGender" name="StudentGender">
<
option>Select Gender</option>
<option>Male</option>
<option>Female</option>
</select>

Editor:
https://www.tutorialsteacher.com/mvc/htmlhelper-editor-editorfor

Publicado por

Juan Pablo Fuentes

Formador de programación y bases de datos