views:

19

answers:

1

Hi there, I've come across an annoying problem that's probably really easy to solve if you're not a newb like myself...

I've got a DropDownList in ASP.Net that has a ListItem that requires being disabled... but I DON'T mean Enable="False". And I also don't want to disable the entire DropDownList, just one specific ListItem. What I'm talking about is written in HTML as disabled="disabled", like so...

<option disabled="disabled" value="-1">Disabled Option</option>

Anyone know how to do this in ASP.Net?

Thanks a lot.

+1  A: 

Have you tried adding disabled="disabled" on the ListItem element?

<asp:DropDownList runat="server" ID="id">
    <asp:ListItem Text="Test" Value="value" disabled="disabled" />
</asp:DropDownList>

Bear in mind that browser compatibility varies: http://www.lattimore.id.au/2005/06/18/disable-options-in-a-select-dropdown-element/

Arnold Zokas
Well, I'll be. Even though Visual Studio 2010 says it's a problem, it works on the live site. Thanks a lot!
Django Reinhardt