all groups > asp.net building controls > august 2003 >
You're in the

asp.net building controls

group:

RaisePostBackEvent and Web Controls Event Handlers



RaisePostBackEvent and Web Controls Event Handlers Lucas Tam
8/31/2003 4:13:21 PM
asp.net building controls: 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!

--
Lucas Tam (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
Re: RaisePostBackEvent and Web Controls Event Handlers Teemu Keiski
8/31/2003 8:03:35 PM
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




[quoted text, click to view]

AddThis Social Bookmark Button