Adding ASCX controls at runtime problem

G

Gonçalo Boléo

I have an ASCX control with 2 objects (asp:label and asp:xml)
I wan't to add this control using Controls.Add() because my business logic
requires to select the correct control to show.

I have some code on ASCX page_load event that makes references to asp:label
(only set text property to it) and asp:xml.

If i add the control directly in an ASPX page i have no problems but if i
add it with Controls.Add() i have the following error: "Object reference not
set to an instance of an object"

What could be the solution? Should i put the logic in another event?

thanks,
Gonçalo Boléo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top