Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I can't get this asp.net dropdownlist to show the items on mouseover.
Thanks for your help

XML
<asp:DropDownList runat="server" ID="cbSort" CssClass="dropDownList" AutoPostBack="true" OnSelectedIndexChanged="cbItemsPerPage_SelectedIndexChanged" Width="155">
                    <asp:ListItem Text="Title A-Z" Value="1a" Selected="True"></asp:ListItem>
                    <asp:ListItem Text="Sub Type Z-A" Value="7z"></asp:ListItem>
                </asp:DropDownList>


$(document).ready(function () {
$("#MainContent_cbSort").hover(function () {
$(this).size = 2;
});
});
Posted
Comments
Not clear. What you want to show on hover of which control ?

The jQuery size() method returns the number of elements in the jQuery object (and is deprecated), so that's probably not what you meant to call. Maybe this is what you meant:
JavaScript
$('#MainContent_cbSort').hover(function(){
    $(this).attr('size', 2);
},function(){
    $(this).removeAttr('size');
});
 
Share this answer
 
Brian,
You are right, I was just trying different options. I'm trying to do the same as ebay.com sort option. You dont have to click to see the items on the drop down list, when the mouse is over the control, it shows you the items.
Thanks,
Martin
 
Share this answer
 
Comments
Brian A Stephens 30-May-13 15:26pm    
So my solution above should do what you want. If so, please "accept" it as the answer; if not, then clarify what you want different. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900