Run Javascript Method after UpdatePanel finishes Updating?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pselus

    #1

    Run Javascript Method after UpdatePanel finishes Updating?

    I need to run a Javascript method that I have when an UpdatePanel
    finishes updating. (i.e. AFTER the event that triggers it runs)
    Can anyone help out with that?

    To make it more complicated, the control that I need to do it from is
    a UserControl that is loaded into another UserControl that is loaded
    into my Default.aspx.
  • Pselus

    #2
    Re: Run Javascript Method after UpdatePanel finishes Updating?

    So I discovered the EndRequestHandl er code that I can use, however
    when I do this line of code:

    <script type="text/javascript" language="JavaS cript">

    Sys.WebForms.Pa geRequestManage r.getInstance() .add_endRequest (EndRequestHand ler);
    </script>

    I get "'Sys' is undefined" even though I have everything in my
    Web.Config correct according to this page:
    You might receive the error 'Sys' is undefined when running ASP.NET AJAX Web pages or trying to AJAX enable your exisitng Web Applicaitons.

    Comment

    • Pselus

      #3
      Re: Run Javascript Method after UpdatePanel finishes Updating?

      Turns out that line of code must be called AFTER the Scriptmanager's
      declaration.

      Comment

      • =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=

        #4
        RE: Run Javascript Method after UpdatePanel finishes Updating?

        This should be a good starting point:

        <script type="text/javascript">

        function onEndRequest(se nder, e)
        {
        // do something ...
        }

        function onBeginRequest( sender, e)
        {
        // do something ...
        }

        Sys.WebForms.Pa geRequestManage r.instance.add_ endRequest(onEn dRequest);
        Sys.WebForms.Pa geRequestManage r.instance.add_ beginRequest(on BeginRequest)

        </script>

        If you are using AjaxControlTool kit you could also utilize
        UpdatePanelAnim ation.


        Hope this helps
        --
        Milosz


        "Pselus" wrote:
        I need to run a Javascript method that I have when an UpdatePanel
        finishes updating. (i.e. AFTER the event that triggers it runs)
        Can anyone help out with that?
        >
        To make it more complicated, the control that I need to do it from is
        a UserControl that is loaded into another UserControl that is loaded
        into my Default.aspx.
        >

        Comment

        Working...