Styling ASP.net controls with bootstrap -
i trying style quiz checkbox/radio button lists controls in asp.net match of bootstrap static variants found here: http://getbootstrap.com/javascript/#buttons-checkbox-radio
this works fine using 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 have 3 problems:
- the items rendered in steps so: http://i.imgur.com/am1a1gh.png, believe cause "repeatlayout=flow" property, without element isn't displayed shown on bootstrap website http://getbootstrap.com/javascript/#buttons-checkbox-radio
- when displayed on smaller screen, of items not fit text within them quite long, best way fix this? image: http://imgur.com/opcsbld
and lastly:
- after form submitted, postbacks page disabling control via vb code, , highlighting correct answer. however, removes element styling
this html displayed when taken 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 aspnetdisabled span tag, interferring bootstrap styles. how can make them persist through this, or there alternative better way disable element?
thanks
read following msdn document
that because of controlrenderingcompatibilityversion. if framework version above 4, property set default "pages controlrenderingcompatibilityversion="4.0"
change controlrenderingcompatibilityversion="3.5" , can see class="aspnetdisabled" removed html.
web control facility after .net version 3.5
method 1 :
please add following in web.config remove aspnetdisabled tag
<system.web> <pages enableeventvalidation="true" controlrenderingcompatibilityversion="3.5" /> </system.web>
method 2 :
you can ended doing following, removes insertion of class disabled items.
void application_start(object sender, eventargs e) { // code runs on application startup webcontrol.disabledcssclass = ""; }
Comments
Post a Comment