Thursday, March 22, 2012
Strange firing sequence??
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.Sorry folks: spellchecker out of control.
COCA = CC1
IMAGO = IMG1
"Assaf" <at@.isp.com> wrote in message
news:%23jh5xwwPEHA.648@.TK2MSFTNGP10.phx.gbl...
> 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.
>
Strange firing sequence??
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.Sorry folks: spellchecker out of control.
COCA = CC1
IMAGO = IMG1
"Assaf" <at@.isp.com> wrote in message
news:%23jh5xwwPEHA.648@.TK2MSFTNGP10.phx.gbl...
> 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.