SharePoint ServerClick problem

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.
 
K

kevish

Please disregard ... posted to wrong group. If you know the answer,
please reply to an identical message under
microsoft.public.sharepoint.portalserver

Sorry!

Kevin.
 

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

Top