K
kevish
Hello all. Hopefully someone can help me with this. My problem is
that the event attached to the ServerClick of an HtmlControl fires
after CreateChildControls.
I have been told that in order to create controls within a webpart, one
must override the CreateChildControls method. In this method, I create
various child controls and attach to each a ServerClick event handler
(GenericClick). This method reads a custom HTML attribute and stores
that value in a class-wide variable (_thisDir).
Now, it is imperative that the click event be handled *before*
CreateChildControls is called, since the creation of the child controls
depends directly and exclusively on the value of _thisDir.
However, in debugging my code, I have noticed that CreateChildControls
is called even before the event handler, and this is unacceptable.
Does anyone know how I can force this method to "wait" until after the
GenericClick method has finished? Or can anyone think of another
work-around?
I have tried eliminating the CreateChildControls method and inserting
its code into the top of RenderWebPart, which is called at the correct
time. However, when I do this, GenericClick is never called at all,
suggesting that event handlers cannot be added by the time control gets
to RenderWebPart, which is something else I don't really understand.
*Shrug*.
If anyone can help me with this, I'd be very appreciative.
Kevin.
that the event attached to the ServerClick of an HtmlControl fires
after CreateChildControls.
I have been told that in order to create controls within a webpart, one
must override the CreateChildControls method. In this method, I create
various child controls and attach to each a ServerClick event handler
(GenericClick). This method reads a custom HTML attribute and stores
that value in a class-wide variable (_thisDir).
Now, it is imperative that the click event be handled *before*
CreateChildControls is called, since the creation of the child controls
depends directly and exclusively on the value of _thisDir.
However, in debugging my code, I have noticed that CreateChildControls
is called even before the event handler, and this is unacceptable.
Does anyone know how I can force this method to "wait" until after the
GenericClick method has finished? Or can anyone think of another
work-around?
I have tried eliminating the CreateChildControls method and inserting
its code into the top of RenderWebPart, which is called at the correct
time. However, when I do this, GenericClick is never called at all,
suggesting that event handlers cannot be added by the time control gets
to RenderWebPart, which is something else I don't really understand.
*Shrug*.
If anyone can help me with this, I'd be very appreciative.
Kevin.