简体   繁体   中英

Keeping this combo box enabled

I have 3 rad drop down lists. On page load ComBox_MDCList is disabled until one of other drop downs selected index = "Pizza". The problem is that after it is enabled by the first dropdown, if the 2nd dropdown is selected and does not = Pizza it will then disable again. How can I keep ComBox_MDCList enabled as long as 1 dropdown = Pizza?

Page Load

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    ComBox_MDCList.Enabled = False
End Sub

sub called

 Protected Sub MDCList()
        If (ComBox_Growth1.Text Or ComBox_Growth2.Text = "Pizza") Then
            ComBox_MDCList.Enabled = True
        Else
            ComBox_MDCList.Enabled = False
        End If
    End Sub

1st drop box vb

  Protected Sub ComBox_Growth1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ComBox_Growth1.SelectedIndexChanged

    If ComBox_Growth1.Text = "Pizza" Then
        MDCList()
    End If

End Sub

2nd drop box vb

Protected Sub ComBox_Growth2_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ComBox_Growth2.SelectedIndexChanged

    If ComBox_Growth2.Text = "Pizza" Then
        MDCList()
    End If

End Sub

Try

Protected Sub MDCList()
     If (ComBox_Growth1.Text = "Pizza" Or ComBox_Growth2.Text = "Pizza") Then
         ComBox_MDCList.Enabled = True
     Else
         ComBox_MDCList.Enabled = False
     End If
End Sub

Protected Sub ComBox_Growth1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ComBox_Growth1.SelectedIndexChanged
     MDCList()
End Sub

Protected Sub ComBox_Growth2_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ComBox_Growth2.SelectedIndexChanged
     MDCList()
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM