Customer Rendered Web Controls - Page.GetPostBackEventReference vs IPostBackEventHandler

Discussion in 'ASP .Net' started by Mr Newbie, Nov 7, 2005.

  1. Mr Newbie

    Mr Newbie Guest

    I still have a few questions here. Ive been following some examples in a
    Microsoft Press book on this and have produced a small calculator control
    which I have written most of the code for.

    My quandy relates to the Postback.

    I have rendered my buttons with OnClick="Javascript:" &
    Page.GetPostBackEventReference(ControID) which when rendered does a
    _doPostback('ControlID,'') javascript call and post the page back.

    The event handlers for the click events on these buttons fire and in turn
    raise a control event to tell the containing page that the event has fired
    and for this I pass a derived EventArgs which carries the Button ID and
    value etc in order to communicate this information.

    My Question is mainly centred aournd the IPostBackEventHandler. I have
    implemented this and have also tried it without, and I see no difference. Im
    convinced that Ive missed the point here, but I cant see it.

    Can anyone illuminate?
    Mr Newbie, Nov 7, 2005
    1. Advertisements

  2. Mr Newbie

    Mr Newbie Guest

    Actually I have taken this forward a little since my post, but Im still not
    entirely sure which approach is the best.

    If you render your Custome Control Buttons with a Javascript onClick to
    Page.GetPostBackEventReference(me), then the IPostbackEventHandler's
    RaisePostbackEvent will get called. However, if you want the underlying
    controls ( Buttons ) to fire their own Click Handler then you need to render
    them with a Javascript Page.GetPostBackEventReference(CONTROLID).

    In the latter case, this RaisePostbackEvent never gets called.

    I think that there is more than one way to skin a cat, but Im not sure which
    one is approved ?, any ideas on approach would be welcome.
    Best Regards

    The Inimitable Mr Newbie º¿º
    Mr Newbie, Nov 7, 2005
    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.