Twitter-Bootstrap-MVC
Twitter-Bootstrap-MVC copied to clipboard
Labels have not the correct markup
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>
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.
Do you prefer having a HtmlHelper extensions for label or straight HTML markup?
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.
@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!