2015/08/11

Add Tooltip to Html helpers

Use the "title" attribute to the html helper. For example:
@Html.CheckBoxFor(m => m.ForTest, new { title = "測試" })

2015/08/10

Apply Enum onto @Html.DropDownListFor

enum GenderType
{
    male,
    femail,
    others
}
@Html.DropDownListFor(model => model.Gender, new SelectList(Enum.GetValues(typeof(GenderType))))

@Html.LabelFor /wo newline

Here is how to prevent @Html.LabelFor from rendering a new line:
@Html.LabelFor(m => m.Title, new { style = "display:inline" })