1

In one criteria I have to underline @Html.Display for like below.

enter image description here

I know to do it simple label but using Razor syntax I tried lot but no luck. Please guide me. Below is my code.

<label style="font-size: xx-large; font-weight: 700">@Html.DisplayFor(Model => Model.Lane_Number, new { @border_bottom:"thick solid #ff000"})</label>
tereško
  • 58,060
  • 25
  • 98
  • 150
Ryder
  • 514
  • 1
  • 7
  • 27

1 Answers1

1

You have to use a span element in order for it to work.

<span class="test" style="border-bottom: 4px solid #CC4040;"> 

       @Html.DisplayFor(x => x.Lane_Number) 

</span>

Make sure if you have any elements below the DisplayFor, they are far enough down on the page or else the underline will be hidden

CSharper
  • 5,420
  • 6
  • 28
  • 54
  • Check out http://stackoverflow.com/questions/10374318/change-displayfor-text-value-through-jquery – CSharper Jun 04 '14 at 19:40
  • totally unrelated but maybe you could help here http://stackoverflow.com/questions/24046058/custom-assembly-attribute-to-string – aaronmallen Jun 04 '14 at 19:57