I have created few buttons and dropdowns dynamically. Code compiles fine but My event handlers are not firing? How should I handle this situation?

Protected Sub CreateAndLoadDropdowns()
       Dim ddlBureauDropdowns As New DropDownList
        Dim btnGo As New Button         
         With btnGo
            .Text = "Go"
            .ID = tempList2(0).MenuID
        End With       
        AddHandler btnGo.Click, AddressOf Me.btnGo_Click
        AddHandler ddlBureauDropdowns.SelectedIndexChanged, AddressOf Me.ddlBureauDropdowns_SelectedIndexChanged
End Sub

Protected Sub btnGo_Click(sender As Object, e As EventArgs) End Sub

Protected Sub ddlBureau_SelectedIndexChanged(sender As Object, e As EventArgs) End Sub

Update: I have moved the code to Page_init.

Related posts

Recent Viewed