Strange firing sequence???

A

Assaf

Hi all. Can't explain this....

I am using custom control COCA that includes an Image IMAGO. IMAGO raises
the Click event for COCA when clicked. All good so far.

The custom control COCA is created dynamically and lives on a Webform1.
Whenever COCA is clicked, the COCA_Clicked event on Webform1 needs to fire
and return the coordinates values of COCA to a textbox on the form (done via
VB: AddHandler CC1.Click, AddressOf CC1_Clicked).

Here's the confusing part: when CC1 is clicked on the form the first thing
that happens is the page posts back. Only then, CC1_Clicked fires, and
writes value to the textbox. I see CC1_Clicked running by settping through
and the values ARE being written to the textbox but they never actually show
up on the form because they are written after the postback. A second click
causes a postback, writes out the previous values, runs CC1_Clicked... so
the output on the form is always 1 phase behind.

Scratching my head... shouldn't this be the other way around?
Click >> CC1_Clicked fires >> writes values to textbox >> page postback???

The custom control:
- Implements INamingContainer
- adds the ImageButton control in CreateChildControls()
- Overrides the Render method and uses EnsureChildControls()
- Is added to the webform with: Me.FindControl("form1").Controls.Add(CC1)

Any ideas? Suggestions? Corrections?

Thanks. Assaf.
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top