Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can anyone help me?

i wanna a make a dropdownlist that on focus shows your listItens!:thumbsup:
easy! =)

improve..

my dropDownList already populated...

i wanna imitate the action click on DropDrownList... show the items... but i wanna make this in the event on focus.

is it clear now!? :cool:
Posted
Updated 25-Jun-10 6:54am
v3
Comments
Sandeep Mewara 24-Jun-10 15:43pm    
What do you mean by dropdown showing listitems? Do you want to show listitems on selection of particular dropdown item or you are saying a focus on textbox should show a listview?

William Silva wrote:
i wanna imitate the action click on DropDrownList... show the items... but i wanna make this in the event on focus

What you are trying is to expand/open the dropdownlist and show its items on focus itself instead of clicking it.

As such, this showing/expanding the list is not a feature provided and cannot be done. Though there is a workaround to it which can be used if the result is acceptable.

Workaround:
1. Get the total number of items shown in the dropdown (lets say N).
2. Now on focus, call a JavaScript function that will change the 'size' of the dropdown from 1 to N

Something like:
<select id="mySelect" runat="server"  onfocusin="Open_Dropdownlist()" onfocusout="Close_Dropdownlist()">

JavaScript
function Open_Dropdownlist()
{
document.getElementById("mySelect").size=N;
}
function Close_Dropdownlist()
{
document.getElementBById("mySelect").size=1;
}
 
Share this answer
 
v2
Comments
William Silva 25-Jun-10 9:15am    
i've already made this, but this action do not imitated a click on dropdownlist that is i wanna to do.
You should look up jQuery. Loading your list items once the pages are loaded is going to require a callback of some form.
 
Share this answer
 
Comments
Sandeep Mewara 24-Jun-10 15:44pm    
Are you clear with the question? Not sure if OP is really asking loading listitem after pageload.
hammerstein05 24-Jun-10 16:40pm    
You think the OP is asking if you can make the drop down list show when focused? Rather than populate when focused?
William Silva 24-Jun-10 16:51pm    
with just jQuery its not possible...i think... i tried with xhtmlxCombo but i had problems with AJAX. =(
Sandeep Mewara 24-Jun-10 17:16pm    
There were multiple things that can be concluded so i was a little confused, but reading your answer - it looked like you were confident on what OP was asking so was a little curious on how so! :)

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