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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -