Why am I getting error 'not declared'?

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.

Answers


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.


Need Your Help

Angular - receiving info from controller inside directive

angularjs communication directive

I have a directive which is responsible to render audio and video items on a page:

Data structure for UDP Server parsing JSON objects in python

python json parsing udp server

I have a UDP server listening to incoming traffic in a thread. The messages come from an external device in JSON format, for example, {"_id": "0x00", "status": "on"}. This information needs to be p...