Twitter-Bootstrap-MVC icon indicating copy to clipboard operation
Twitter-Bootstrap-MVC copied to clipboard

Labels have not the correct markup

Open couellet opened this issue 13 years ago • 4 comments

In a form, labels must have the CSS class control-label.

Currently, the scaffolding generates them like this:

@Html.LabelFor(model => model.PropertyName)

The output is:

<label for="PropertyName">PropertyName</label>

The output should be:

<label for="PropertyName" class="control-label">PropertyName</label>

couellet avatar May 01 '12 18:05 couellet

Thanks @couellet - it's actually something I brought up on their version 2.0 - because they were using that in their website (which acts as the documentation) but they didn't actually have a matching class property in their CSS at the time.

I should be paying closer attention to what they've done.

I'm happy if you want to add it in otherwise when I get home I will try to find the time to add it in myself.

Appreciated.

andrewtobin avatar May 02 '12 05:05 andrewtobin

Do you prefer having a HtmlHelper extensions for label or straight HTML markup?

couellet avatar May 02 '12 15:05 couellet

I have added some Bootstrap HtmlHelper extensions to my fork of this project. One of them adds the control-label class to labels.

@Html.BootstrapLabelFor(model => model.PropertyName)

I ended up creating a separate assembly for the extensions as it was easier to call them from the T4 templates. If you are interested I can send a pull request.

gazk avatar May 08 '12 09:05 gazk

@couellet at the moment I've been adjusting the templates as required, so there's that, and the base changes so when people do an install there's a rewrite of the basic install to be bootstrap compat.

@gazk more than happy! that'd be awesome.

I haven't had enough time lately to get back into this, but I'm more than happy if you guys want to contribute to bring them in and credit you guys on the nuget package!

andrewtobin avatar May 08 '12 10:05 andrewtobin