views:

692

answers:

1

I have a dropdownlist to fill in server-side an some of the options that will filled to the this list need to be disabled. Practically I know that I need to add a disabled='disabled' attribute.

That is the first way I tried.

Dim avListItems = activityVersions.Select(Function(av) New With {.Text = av.Text, .Value = av.Value, .Disabled=av.HasQuota}).ToList()

But this disables all options because in HTML disabled attribute do not need a value if there is a disabled attribute then it disables the option in any case. But I need a solution which could add disabled attribute for the options, which has no quota and other should be enabled.

Do you have any suggestion?

+2  A: 

It is not possible to disable individual items in a dropdown list. See MSDN.

Perhaps rather apply some validation to notify the user if an invalid option has been selected, or remove those items from the list entirely.

Ravish