Tag In @html.labelfor?
I am trying to split lable into two lines. But if put in the @Html.LabelFor it is not working is there any alternative options? controller meetingAbstract.AbstractTitleInEnglishL
Solution 1:
Create a regular label
<label for="@Html.IdFor(m => m.AbstractTitleInEnglishLabel)"class="control-label mandatory">
Text above
Text below
</label>
Solution 2:
I would create a custom HtmlHelper.
Inherit IHtmlString
and use TagBuilder
to create one.
Then you can use it with @Html.CustomLabelFor(...)
.
Solution 3:
so that the html will render you will need to use html.raw. try changing it to this
<label class="control-label mandatory">@Html.Raw(model => model.AbstractTitleInEnglishLabel)</label>
Solution 4:
Where do you want to put break within label? After 1st, 2nd, 3rd, n-th word?
IMHO, it's better to increase the height of label and let HTML render it on it's own.
In your css set:
.control-label{
height: 60px; /* or change accordingly */
}
Solution 5:
@Html.Raw(HttpUtility.HtmlDecode(@Html.LabelFor(model => model.AbstractTitleInEnglishLabel, Model.AbstractTitleInEnglishLabel, new { @class = "control-label mandatory" }).ToString()))
Post a Comment for "
Tag In @html.labelfor?"