make drop down list item unselectable

后端 未结 9 524
天涯浪人
天涯浪人 2020-11-30 07:26

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

9条回答
  •  孤城傲影
    2020-11-30 08:06

    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:

    foreach ( ListItem item in dropdownlist.Items )
    {
      if ( [item should be disabled contdition] )
      {
         item.Enabled = false;
      }
    }
    

    and it worked for me.

提交回复
热议问题