html - How to apply a bootstrap dropdown to asp.net dropdownlist control -


i have dropdownlist controls populated database. want apply bootstrap dropdownlist effect it. how can it. tried form-control dropdown control changes , not bs dropdown, list same 1 in asp.net.

the second image want. , first 1 when apply form control

code:

  <asp:dropdownlist id="ddlctype" runat="server" cssclass="form-control" datasourceid="sqldatasource1" datatextfield="comp_type" datavaluefield="type_id"  autopostback="true" ondatabound="ddlctypedatabound" style="width: 400px"> 

current dropdownlist

i want this

it seems bootstrap 3 not able pick 'form-control' rendered html asp.net engine. here options.

option 1 : assign class during page load.

<script>     $().ready(function(){     $('#<%=ddlctype.clientid%>').addclass("form-control");     }); </script> 

option 2 : : use bootstrap-select plugin.

<asp:dropdownlist id="ddlctype" runat="server" cssclass="selectpicker" datasourceid="sqldatasource1" datatextfield="comp_type" datavaluefield="type_id"  autopostback="true" ondatabound="ddlctypedatabound" style="width: 400px">  <script> $().ready(function(){ $('#<%=ddlctype.clientid%>').selectpicker(); }); </script> 

example : http://jsfiddle.net/dinomyte/wd1z0zmg/8/


Comments

Popular posts from this blog

ios - UITEXTFIELD InputView Uipicker not working in swift -

Hatching array of circles in AutoCAD using c# -