Pergunta

I'm trying to show a DropDownList (cbb_conj_habitacional) if the selected value of another DropDownList (cbb_area_verde) equals 7... But, when I try this code, I get the following error:

Name 'cbb_area_verde' is not declared and it also goes to cbb_conj_habitacional.

Protected Sub cbb_area_verde_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim selecionado As Integer
    selecionado = cbb_area_verde.SelectedItem.Value
    If (selecionado = 7) Then
        cbb_conj_habitacional.Visible = True
    End If
End Sub

And yes, I'm in my partial class.

Foi útil?

Solução

I know now what I did wrong... My "cbb_conj_habitacional" is inside of a formview, so I just declared it by findControl.

Dim cbb_conj_habitacional AS DropDownList = formView.FindControl("cbb_conj_habitacional")

I hope it can help someone.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top