[Atlas Beta1] how to manually trigger an async postback

Discussion in 'ASP .Net Building Controls' started by Patrick Ruzand, Oct 27, 2006.

  1. Hello,

    I have developed a custom ASP.NET WebControl and I am now testing a possible
    Atlas integration, to take advantage of the UpdatePanel partial refresh.

    My WebControl subclass consists on a simple control that renders itself as
    an <img> tag with an associated <imagemap>, the imagemap being used to
    provide tooltips. Coupled with this img, it adds an OnClick event handler
    that performs some hidden field initialization and then calls
    myform.submit(). That's it for my control.

    To test Atlas UpdatePanel features, I have added my control to the
    ContentTemplate of an UpdatePanel. Unfortunately, with no success: when I
    click on my image, the full page is loaded.
    After some investigations, it happens that, from what I have understood, the
    whole async postback mechanism relies on the form.onsubmit event. At least,
    that's what I deduced from the PageRequestManager.OnFormSubmit event handler.
    Which explains the problem I am facing: because calling form.submit does not
    raise onsubmit event, the PageRequestManager.OnFormSubmit is never called
    when I click on my image and the page is fully reloaded.

    To be sure the problem came from here, I replaced the call to
    'myform.submit' by:
    and it works.

    So, what is the proper methodology to trigger an async postback in such a
    configuration ? Is there a way to manually trigger an onsubmit ?

    (changing the <img> tag with an <input type="image"> and removing the
    explicit call to 'myform.submit' is not a solution. In this configuration, it
    works fine, but the problem is the imagemap is then lost (not taken into
    account by thr browser with an 'input' image)).

    Thanks a lot for your help,

    Patrick Ruzand, Oct 27, 2006
    1. Advertisements

  2. Hello Patrick,

    From your description, I understand you want to integrate the ATALS
    updatepanel feature into your custom web control.

    Based on my understanding, updatepanel is one of the atlas component that
    support partial rendering and updating, however, for custom web control's
    development, you may have to consider the following things:

    1When using ATLAS in asp.net application, you need to configure and deploy
    the ATLAS package in the whole application rather than simply configure in
    your control. Therefore ,your webcontrol will be retricted to ATLAS
    application only.

    Also, as you mentioned the following code snippet


    Are you doing any customization on the updatepanel page's postback?

    BTW, from the title, you're using the latest beta1 version of the
    ATLAS(ASP.NET AJAX) package, correct?


    Steven Cheng

    Microsoft MSDN Online Support Lead


    Get notification to my posts through email? Please refer to

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Oct 30, 2006
    1. Advertisements

  3. Hello Steven,
    In fact, I am investigating how our WebControl developped in ASP.NET 1.0
    could be integrated into the UpdatePanel framework. My WebControl consists
    on basically an image plus an imagemap that performs a submit when the
    user click on the image.
    My first thought was that it would take advantage of the UpdatePanel partial
    refresh without modifying my WebControl, just by adding it to an
    ContentTemplate, something like that:
    <asp:UpdatePanel id="updatepanel1">
    <cc1:MyControl .../>

    But it did not work. Indeed, as I told you, my WebControl uses an onClick
    event handler to perform some checking/initialization and then calls
    explicitely to perform the postback. The problem is that this postback
    seems not to be catched by the Atlas PageRequestManager class, the latter
    listening the onsubmit event. Since form.submit() does not raise onsubmit
    my postback pass through the partial refresh mechanism, and the page is
    fully reloaded.
    But again this is my understanding, it may be totally wrong.
    yes, this is the only workaround I found for the time being, calling
    the Atlas PageRequestManager's functions that are called by the
    onsubmit event handler.
    In fact, another workaround is to use an <input type=image> instead of an
    When the user click on my control (the <img> in the rendered html), it posts
    a form.submit(). In response to this submit, my webcontrol performs some
    action on the server that may change the appearance of the control, and then
    Yes, that's correct.


    Patrick Ruzand, Oct 31, 2006
  4. Thanks for your reply Patrick,

    I'll have a look and perform some further research. I'll update you if I
    get any new information.


    Steven Cheng

    Microsoft MSDN Online Support Lead

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Nov 2, 2006
  5. Hi Patrick,

    After some further investigation, I'm afraid so far I haven't found any
    other better means on this. Does your current workaround fit the scenario,
    if so, you can continue using it now. Also, I would suggest you post
    request to the AJAX forum in WWW.ASP.NET site since there some web UI
    team's engineer there.


    Steven Cheng

    Microsoft MSDN Online Support Lead

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Nov 7, 2006
  6. Hi Patrick,
    Thanks Steven. I'll see whether the workaround I found might be
    used in the final product.
    Also, being currently in Barcelona for MS TechEd Developer, I'll
    try to catch an Atlas engineer and see if there are other ways.

    Thanks for your help,

    Patrick Ruzand, Nov 7, 2006
  7. Hello Patrick,

    Thanks for your reply.

    If you get any further progress later, please feel free to post here so
    that any other members and also reference to it.


    Steven Cheng

    Microsoft MSDN Online Support Lead

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Nov 8, 2006
  8. Hello Patrick,
    Thanks to the great Atlas team at TechEd, my problem is eventually solved.
    Actually, the issue was that I was doing the submit in the old ways,
    that is calling form.submit().
    In ASP.NET, you should not call the submit() method because doing this,
    you bypass the ASP postBack mechanism. Instead, you should
    call the PostBack event handler reference.
    In my case, the javascript code generation should be written as:
    "")+";{0}", Environment.NewLine);

    where 'script' is a StringBuffer containing the javascript code generated
    by my WebControl.

    And then all works fine.

    Patrick Ruzand, Nov 13, 2006
    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.