Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
I have a drop down list that has several options in it but I need to have a custom validator which does not allow the user to select 4 of the potential options in the drop down list. Any help would be greatly appreciated.
Posted
Comments
Sergey Alexandrovich Kryukov 7-Jul-11 14:04pm    
What would be the purpose of items which are visible in the list but not selectable? No wonder this option does not present in the original list view controls...
--SA

1 solution

First of all, even if you implement such behavior, it cannot be called "validator". A "validator" is something which validates data after it is entered, but you want to filter out the input (selection) itself.

I fear to say such behavior is too far from expected UI behavior and would be very confusing. Implementation of it would be problematic, too.

There is a well-known equivalent UI presentation with the same logic: a set of radio buttons. If you control Enabled property of each radio button, you can enable or disable some of them depending on other data, effectively filtering the input the way you want.

See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobutton.aspx[^].

—SA
 
Share this answer
 
v3
Comments
Espen Harlinn 7-Jul-11 14:37pm    
Good points, my 5
Sergey Alexandrovich Kryukov 7-Jul-11 14:44pm    
Thank you, Espen.
--SA

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