make drop down list item unselectable

2019-01-09 02:30发布

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.

8条回答
Luminary・发光体
2楼-- · 2019-01-09 03:19

You could try this

myDropDownList.Items.FindByValue("ReportValue").Attributes.Add("disabled", "disabled");
查看更多
做个烂人
3楼-- · 2019-01-09 03:21

Try this

myDropDownList.Items.FindByValue("ReportValue").Enabled = false;

This will disable the item from the list by basically not showing it in the list.

"ReportValue" = the value of the item to be disabled.

查看更多
登录 后发表回答