[Atlas Beta1] how to manually trigger an async postback

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default [Atlas Beta1] how to manually trigger an async postback

    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:
    PageRequestManager.getInstance()._onFormElementCli ck(a_Sys_UI_DomEvent);
    PageRequestManager.getInstance()._onFormSubmit(a_S ys_UI_DomEvent);
    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
    Patrick Ruzand Guest

  2. Similar Questions and Discussions

    1. Atlas and VS2003!!!
      is there any way to create an asp.net control in VS2005 and then use it by any means in VS2003 ?? is there a way to acheive this by any means...
    2. Atlas not working properly after my control is added
      I have a Web Control that is affecting the correct functioning of Atlas and I don't know why. I put together a very small sample control along with...
    3. asp:fileupload within Atlas Update Panel
      I am having problems retireving the file information when you place an asp:fileupload control inside an Atlas UPdate Panel. Has any body got a...
    4. Problems with Flex 2.0 beta1
      Hi all, i was running my Flax 2.0 beta1 but from one day to another this problem occured: "c:\windows\system32\macromed\flash\flash8a.ocx You...
    5. Async db calls in CF5?
      We have encountered an issue with some very-long-running stored procedures, and one of the possibilities I was asked to look at is whether it is...
  3. #2

    Default RE: [Atlas Beta1] how to manually trigger an async postback

    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

    ==============
    PageRequestManager.getInstance()._onFormElementCli ck(a_Sys_UI_DomEvent);
    PageRequestManager.getInstance()._onFormSubmit(a_S ys_UI_DomEvent);
    ==============

    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?


    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    [url]http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif[/url]
    ications.



    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
    [url]http://msdn.microsoft.com/subscriptions/support/default.aspx[/url].

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.


    Steven Cheng[MSFT] Guest

  4. #3

    Default Re: [Atlas Beta1] how to manually trigger an async postback

    Hello Steven,
    > 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.
    >
    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
    UpdatePanel's
    ContentTemplate, something like that:
    ....
    <asp:UpdatePanel id="updatepanel1">
    <ContentTemplate>
    <cc1:MyControl .../>
    </ContentTemplate>
    </asp:UpdatePanel>
    ....

    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
    form.submit()
    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
    event,
    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.
    > Also, as you mentioned the following code snippet
    >
    > ==============
    > PageRequestManager.getInstance()._onFormElementCli ck(a_Sys_UI_DomEvent);
    > PageRequestManager.getInstance()._onFormSubmit(a_S ys_UI_DomEvent);
    > ==============
    yes, this is the only workaround I found for the time being, calling
    explicitely
    the Atlas PageRequestManager's functions that are called by the
    PageRequestManager's
    onsubmit event handler.
    In fact, another workaround is to use an <input type=image> instead of an
    <img> but
    in this case I lose the benefit of the imagemap.
    > Are you doing any customization on the updatepanel page's postback?
    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
    renders
    a new <img>.
    > BTW, from the title, you're using the latest beta1 version of the
    > ATLAS(ASP.NET AJAX) package, correct?
    Yes, that's correct.

    Thanks,

    Patrick


    Patrick Ruzand Guest

  5. #4

    Default Re: [Atlas Beta1] how to manually trigger an async postback

    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.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Steven Cheng[MSFT] Guest

  6. #5

    Default Re: [Atlas Beta1] how to manually trigger an async postback

    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 [url]WWW.ASP.NET[/url] site since there some web UI
    team's engineer there.


    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    This posting is provided "AS IS" with no warranties, and confers no rights.

    Steven Cheng[MSFT] Guest

  7. #6

    Default Re: [Atlas Beta1] how to manually trigger an async postback

    > 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 [url]WWW.ASP.NET[/url] site since there some web UI
    > team's engineer there.
    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


    Patrick Ruzand Guest

  8. #7

    Default Re: [Atlas Beta1] how to manually trigger an async postback

    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.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Steven Cheng[MSFT] Guest

  9. #8

    Default Re: [Atlas Beta1] how to manually trigger an async postback

    > 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.
    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:
    script.AppendFormat("\t\t"+Page.ClientScript.GetPo stBackEventReference(this,
    "")+";{0}", Environment.NewLine);

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

    And then all works fine.

    Thanks,
    Patrick


    Patrick Ruzand Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139