Dynamically Add User Control - Loads Twice

Y

yohaas

I am dynamically adding user control to a page using
Controls.Add(control). It seems that the Page_Load as well as the other
page rendering events (Init, PreRender etc...) get fired twice. I
assume that they are firing once by the Control.Add and once by the
actual rendering of the page.

The interesitng thing is that when it is a postback, the first time it
fires IsPostBack is true but the second time, it's false.

Any ideas what I can do to prevent this double firing?

Thanks,
yohaas
 

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

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top