S
SteveS
I have a user control which I created that does not work when I add it
dynamically to a web page. My code looks like this.
For x = 0 to max
'Instantiate a new conrol
Dim ctrlMyNewControl as new MyNewControl
'Assign the application Id
ctrlMyNewControl.ApplicationId = x
'Add the control to the current web page.
plcPlaceHolder.Controls.Add(ctrlMyNewControl)
Next
I get the following error in my control: Object reference not set to an
instance of an object.
On the line: lblApplicationId.Text = _applicationId
For some reason lblApplicationId is set to nothing even though it is defined
on the .ascx page. I have never added a user control which I created
dynamically. I believe I coded my user control correctly, because it works
when I add it directly to the web page.
Am I creating the dynamic control wrong???
Thank you very much for you help!
Steve
dynamically to a web page. My code looks like this.
For x = 0 to max
'Instantiate a new conrol
Dim ctrlMyNewControl as new MyNewControl
'Assign the application Id
ctrlMyNewControl.ApplicationId = x
'Add the control to the current web page.
plcPlaceHolder.Controls.Add(ctrlMyNewControl)
Next
I get the following error in my control: Object reference not set to an
instance of an object.
On the line: lblApplicationId.Text = _applicationId
For some reason lblApplicationId is set to nothing even though it is defined
on the .ascx page. I have never added a user control which I created
dynamically. I believe I coded my user control correctly, because it works
when I add it directly to the web page.
Am I creating the dynamic control wrong???
Thank you very much for you help!
Steve