RaisePostDataChangedEvent

Discussion in 'ASP .Net Building Controls' started by oneeye, Jul 16, 2003.

  1. oneeye

    oneeye Guest

    Hello All

    I am trying to understand the difference between
    RaisePostDataChangedEvent and RaisePostBackEvent what is each method
    intended for??

    Does anyone have a good explanation or can anyone refer me to a decent
    article on the matter.

    Cheers
     
    oneeye, Jul 16, 2003
    #1
    1. Advertisements

  2. oneeye

    Teemu Keiski Guest

    LoadPostData and RaisePostDataChanged methods are part of
    IPostBackDataHandler interface. That means generally controls that handle
    postback data and change their state based on posted data. Such controls are
    TextBox or DropDownList for example.

    The working with IPostBackDataHandler is that posted data is accessed in
    LoadPostData and if control state is detected to be changed based on this
    process the LoadPostData returns boolean value true, otherwise false. If it
    returns true, IPostBackDataHandler's RaisePostDataChanged method is called.
    This method is intended to raise postback events that inform about the
    change in control's state (like TextBox's TextChanged or DDL's
    SelectedIndexChanged events are). Control that wants to to raise events to
    signal changes in it's state must do it in RaisePostdataChanged. Reason is
    that while LoadPostData is called and if you raise events there, all
    controls on the Page have not yet been loaded and they are not able to
    handle the changed events. LoadPostData happens before Page_Load (for
    controls already in the control tree and right after Page_Load for
    dynamicallya dded controls)

    The RaisePostBackEvent you talked about is relevant with
    IPostBackEventHandler interface. This interface allows server control to map
    a client-side event into a corresponding server-side event. Such control is
    Button for example . RaisePostBackEvent method is meant to raise an postback
    event, with Button it is Click event for example, or with some controls it
    could be multiple events based on parameters passed to the
    RaisePostBackEvent.

    So difference between RaisePostDataChangedEvent and RaisePostBackEvent is
    the context where they are used. Both do raise postback events, but the
    other does it based on change in control's state(data on postback while the
    other informs there has happened some user action that caused control to
    cause postback and to raise an event. Like with Button's Click event is
    informed that button was clicked.

    Hope this helps.

    --
    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
     
    Teemu Keiski, Jul 16, 2003
    #2
    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.