Closed alreadytakenname closed 10 years ago
would that be ok, if there was an overload that took a second parameter to set the for
attribute:
.CustomLabel("My Label", "fieldId")
Hi Dimitry!
Having a second parameter for the for
attribute would mimic the default html helper's behavior.
@Html.Label("targetId", "Text")
renders
<label for="targetId">Text</label>
An overload like that would solve our problem.
I can't do that exactly this way. The .CustomLabel()
helper has been in the BMVC for a long time, so switching parameters would mean breaking existing code for lots of people.
I understand and it doesn't realy matter in which order we have to provide the parameters. It would be nice if you could add this feature in an upcoming release.
The support for this is implemented. Use chain methods like so:
.CustomLabel("label").HtmlAttributes(new { for = "idOfInput" })
Hi Dmitry!
We are using TwitterBootstrapMVC - MVC4 version 3.12.3 to render bootstrap markup. We came across a situation where we needed to use CustomLabel for a CustomControl in a FormGroup however we were not able to set the generated "label" tag's "for" attribute. Booth overloads for CustomLabel render the content inside a label with an empty "for" attribute.
Could you look into this for us? Thanks in advance!