I created a simple page this morning to see if I would get the same error message and I did. Here is the code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myDrpDwn As New DropDownList
myDrpDwn.ID = "categoryddl"
myDrpDwn.Items.Add("Selection 1")
myDrpDwn.Items.Add("Selection 2")
myDrpDwn.Items.Add("Selection 3")
PlaceHolder1.Controls.Add(myDrpDwn)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = categoryddl.SelectedValue
End Sub
It loads fine but when the Submit button is clicked it again displays:
Object reference not set to an instance of an object.
|