I have a dropdownlist which has several options for generating reports. Based on the type of account the user has certain options which should be visible but not selectable (as an incentive for them to upgrade).
I was wondering if anyone knew of a way to accomplish this.
The permissions are already in place i just need assistance with making certain items unselectable.
Any help would be much appreciated.
If this is HTML control, then its very easy to make it UNselecteable. just use the "optgroup" HTML element. e.g.
(NOTE : this works in both IE/firefox)
Thanks Sushil Jinder
I had this same problem and tried to use the first answer posted, but it didn't work for me. I then changed the first post to:
and it worked for me.
You can disable an
<option>
tag in an html<select>
See: http://www.htmlref.com/reference/appa/tag_option.htm
in asp.net:
You could do this client-side with a handler that is triggered when an item is selected. Then unselect the item and/or display an error message.
You can use a required field validator and set the initial value property to the value of the item in the drop down list you do not want selectable.
Not sure if you are still looking for an answer for this?
Mark Redman's answer is great if you can define the select list in the aspx page, however if you bind the drop down list dynamically obviously you cannot.
I had success using the following to achieve the result you are after (not sure on full browser support but works in newer versions of IE)
This will render your disabled elements greyed out.