I am trying to style my quiz with checkbox/radio button lists controls in asp.net to match that of the bootstrap static variants found here: http://getbootstrap.com/javascript/#buttons-checkbox-radio
This works fine using the following lines of code:
<asp:RadioButtonList ID="rblQuestion1" runat="server" RepeatDirection="Vertical" RepeatLayout="Flow" CssClass="btn-group" data-toggle="buttons">
<asp:ListItem class="btn btn-default radio-inline" Value="1">Answer One</asp:ListItem>
<asp:ListItem class="btn btn-default radio-inline" Value="2">Answer Two</asp:ListItem>
</asp:RadioButtonList>
But i have three problems:
- The items are rendered in steps like so: https://i.sstatic.net/fHOhx.png, I believe the cause to be the "RepeatLayout=Flow" property, but without this element isn't displayed as shown on the bootstrap website http://getbootstrap.com/javascript/#buttons-checkbox-radio
- When displayed on a smaller screen, some of the items do not fit as the text within them is quite long, what would be the best way to fix this? Image: https://i.sstatic.net/dQasn.jpg
and lastly:
- After the form is submitted, it postbacks to the page disabling the control via VB code, and highlighting the correct answer. However, this removes the element styling
This is the HTML displayed when taken from the browser:
<span id="ContentMain_wizQuestions_rblQuestion1" disabled="disabled" class="aspNetDisabled btn-group" data-toggle="buttons">
<span class="aspNetDisabled">
<input id="ContentMain_wizQuestions_rblQuestion1_0" type="radio" name="ctl00$ContentMain$wizQuestions$rblQuestion1" value="1" disabled="disabled"><label for="ContentMain_wizQuestions_rblQuestion1_0">Answer One</label></span><br>
<span class="aspNetDisabled"><input id="ContentMain_wizQuestions_rblQuestion1_1" type="radio" name="ctl00$ContentMain$wizQuestions$rblQuestion1" value="2" disabled="disabled">
<label for="ContentMain_wizQuestions_rblQuestion1_1">Answer Two</label></span><br>
<span class="aspNetDisabled"><input id="ContentMain_wizQuestions_rblQuestion1_2" type="radio" name="ctl00$ContentMain$wizQuestions$rblQuestion1" value="3" checked="checked" disabled="disabled">
<label for="ContentMain_wizQuestions_rblQuestion1_2">Answer Three</label></span><br>
<span class="aspNetDisabled"><input id="ContentMain_wizQuestions_rblQuestion1_3" type="radio" name="ctl00$ContentMain$wizQuestions$rblQuestion1" value="4" disabled="disabled">
<label for="ContentMain_wizQuestions_rblQuestion1_3">Answer Four</label>
</span>
I believe the aspNetDisabled span tag, is interferring with the bootstrap styles. How can i make them persist through this, or is there an alternative better way to disable an element?
Thanks