RaisePostBackEvent and Web Controls Event Handlers

Discussion in 'ASP .Net Building Controls' started by Lucas Tam, Aug 31, 2003.

  1. Lucas Tam

    Lucas Tam Guest

    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?

    Lucas Tam, Aug 31, 2003
    1. Advertisements

  2. Lucas Tam

    Teemu Keiski Guest

    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

    AspInsiders Member, www.aspinsiders.com
    ASP.NET Forums Moderator, www.asp.net
    AspAlliance Columnist, www.aspalliance.com
    Teemu Keiski, Aug 31, 2003
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.