Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland asked on

ASP.net Error adding control in Page PreInit event

Hi. The following code gives me an error at the line marked "Error Here"

    Private Sub Dynamic_Data_PreInit(sender As Object, e As EventArgs) Handles Me.PreInit
        Dim oDropDownList As New DropDownList
        oDropDownList.ID = "d1"
        oDropDownList.Items.Add("Test")
        Me.Panel_Controls.Controls.Add(oDropDownList) 'Error here
  End Sub

1
ASP.NET.NET Programming

Avatar of undefined
Last Comment
Fernando Soto

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Fernando Soto

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Murray Brown

ASKER
Great answer. Thanks very much
Fernando Soto

Not a problem murbro, glad I was able to help.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23