css - how to change the selected color of listbox in asp.net -
<asp:listbox id="ddlpa" clientidmode="static" runat="server" autopostback="true" skinid="x" cssclass="listboxcssclass" selectionmode="multiple" onselectedindexchanged="ddlpa_selectedindexchanged"> </asp:listbox>
when select item in asp:listbox , selected item color changes gray, want change color blue. how can same?
you can set background colors .aspx page specifying either cssclass, or backcolor property.. looks like:
<asp:listbox cssclass="mylistbox" backcolor="#e0e0e0"></asp:listbox>
setting selected item little trickier... don't believe there attribute directly. can set in javascript, or jquery, like:
<script type="text/javascript"> $(document).ready(function() { $('#mylistbox').click(function() { $("#mylistbox option:selected").css("background-color", "#e0e0e0"); }); }); </script>
Comments
Post a Comment