DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
224 stars 79 forks source link

radio-inline support ? #198

Closed sgentile closed 10 years ago

sgentile commented 10 years ago

http://getbootstrap.com/css/#forms

I'm having issues getting TwitterBootstrapMvc to work with radio-inline.

The behavior I'm seeing is that it is attaching 'radio' class to the div.

I do believe if it could attach 'radio-inline' on the div and the label it works. Something along the lines of this:

<div class="radio-inline"><label for="Member_Gender_0" class="radio-inline"><input id="Member_Gender_0" name="Member.Gender" type="radio" value="Male">Male<span class="required" style="visibility:hidden;">*</span> </label></div>
sgentile commented 10 years ago

The above html isn't correct - here is the intended result - just not sure how to do this with twitterbootstrapmvc


<div class="form-group">
    <div><label for="Member.Gender" class="control-label">Gender</label><span class="required">*</span></div>
    <div class="radio-inline">
        <label for="Member_Gender_0" class="radio-inline">            
            <input id="Member_Gender_0" name="Member.Gender" type="radio" value="Male">Male
        </label>
        <label for="Member_Gender_1" class="radio-inline">
            <input id="Member_Gender_1" name="Member.Gender" type="radio" value="Female">Female
        </label>
        <label for="Member_Gender_2" class="radio-inline">
            <input id="Member_Gender_2" name="Member.Gender" type="radio" value="Unknown">Unknown
        </label>
    </div>
</div>

This produces: https://dl.dropboxusercontent.com/u/6877923/radiolist.png

DmitryEfimenko commented 10 years ago

so is this for RadioButtonListFor() helper which should produce multiple radio buttons?

sgentile commented 10 years ago

I was trying to use the RadioButtonsFromEnumFor helper

DmitryEfimenko commented 10 years ago

have you tried:

@(f.FormGroup().RadioButtonsFromEnumFor(model => model.courseGradeLevels).DisplayInlineBlock())

?

sgentile commented 10 years ago

I'm using this:

@(f.FormGroup().CustomControls(Html.Bootstrap().Div(Html.Bootstrap().RadioButtonsFromEnumFor(model => model.Person.Gender).DisplayInlineBlock().Label())))

And it is producing this: https://dl.dropboxusercontent.com/u/6877923/radiolistproblem.PNG

subtle, but the first item 'drops' down - it is using a checkbox-inline - not sure if that matters or not...

DmitryEfimenko commented 10 years ago

I just run that exact code and it looks fine for me. Check if you have conflicting css somewhere on your site. If you think the issue is indeed with BMVC, try to reproduce it in the fresh project and send it to me via email.

DmitryEfimenko commented 10 years ago

was this ever resolved?

sgentile commented 10 years ago

sorry been swamped, I haven't tested yet - I'll close and if I reproduce I can open a new item for it