Placeholder and event not fired the first time.

  • Thread starter PKin via DotNetMonster.com
  • Start date
P

PKin via DotNetMonster.com

Hi,
I have a web page with a radioButtonList with 3 buttons (B1,B2 and B3) and a
placeholder.
B1 will put an .ascx file (Pl1.ascx) in the placeHolder, B2 will do the same
with Pl2.ascx and B3 with Pl3.ascx.
Each .ascx file has controls that can fire som events(button, dropList...).
When I start the page, B1 is default and every control on Pl1.ascx work very
fine. When I choose B2 or B3 the .ascx file is loaded in the placeholder but
no control works the first time. I have to press twice to fire the event and
they will work after the second time.
When I go back to B1, I have to do the same procedure again: first time
nothing works and after everything work.

Did I do anything wrong???

Pkin
 
S

S. Justin Gengo

PKin,

I've noticed this behaviour before with dynamically added controls. Try
giving each of your user controls an id explicitly. In each control's
page_load event put Me.Id = "ControlIDHere". I'm not positive why this
works, but my guess is that when .NET is wiring up events it skips over the
dynamic controls because a routine searches out the control based on ID.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
P

PKin via DotNetMonster.com

Hi Justin,
This is very strange but it works. Thanks a lot.

Pkin
 

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,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top