Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all

Am using dropdownlist in my application ,i want to limit the Number of items (i.e
20.) after reacing the count 20 it should prompt that reached the max limit
how to do this

Thanks inAdvance
Posted
Comments
Uday P.Singh 20-Mar-12 6:58am    
are you trying to fill the DDL from database or trying to make your custom DDL.
pradeep manne 20-Mar-12 7:21am    
hi, am not filling DDL with database

one possibility is,Use the size attribute of the select element to specify the count of visible items.
XML
<select size="5">
    <option SELECTED />country1
    <option />country2
    <option />country3
    <option />country4
    <option />country5
    <option />country6
    <option />country7
    <option />country8
    <option />country9
    <option />country10
</select>
 
Share this answer
 
use the take method for the first 20 items on your data source, then bind it to the datasource of the combobox.
http://www.dotnetperls.com/take[^]
 
Share this answer
 

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