RaisePostBackEvent and Web Controls Event Handlers

L

Lucas Tam

If RaisePostBackEvent fires, does this disable Webcontrols events?

It seems when RaisePostBackEvent, my webcontrols event handlers such as
button.click no longer work.

So, what is the best way of mixing non-composite controls and web controls?

Thanks!
 
T

Teemu Keiski

Hmm, perhaps you mean something else? If RaisePostBackEvent fires on your
control, it means your control has fired the postback itself and therefore
for example some other Button's Click event isn't fired. This is as Button
fires its Click even when the button is clicked (Button raises the Click
event by handling IPostBackEventHandler).

So if your control's child control like Button would cause postback, the
containing control's RaisePostBackEvent would not be called. This is if you
use composition approach i.e have the button as child control by creating in
CreateChildControls as the idea with child controls is that they already
contain ready logic to handle things and so on. Generally for such control
event handlers are wired in the CreateChildControls as well.

Case is different if the contained button would be "implemented" via
rendering and the actual action it fires is done by calling to
Page.GetPostBackEventReference when of course the source for postback is
your control itself.

--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

AspInsiders Member, www.aspinsiders.com
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com
 

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,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top