Quantcast
Channel: Code monkey CODE!! » Razor
Viewing all articles
Browse latest Browse all 3

Razor html.textboxfor readonly

$
0
0

Its as simple as passing readonly css attribute to the html extension method.

<div class="editor-label">
    @Html.LabelFor(model => model.Phone )
</div>
<div class="editor-field">
    @Html.TextBoxFor(model => model.Phone, new { @readonly = true })
    @Html.ValidationMessageFor(model => model.Phone)
</div>

Viewing all articles
Browse latest Browse all 3

Trending Articles