locked
Run js function after change RRS feed

  • Question

  • User1510859543 posted

    We have a ListView inside an UpdatePanel and want to be able to run a javascript function AFTER the UpdatePanel refreshes but not sure how to do that.  The ListView InsertItem Template has a radiobutton control and a dropdownlist that call code-behind functions.  I want to run the javascript function using the changed controls after the code-behind sub runs on the server.  Thanks.

    Monday, May 19, 2014 1:35 PM

Answers

  • User-417640953 posted

    We have a ListView inside an UpdatePanel and want to be able to run a javascript function AFTER the UpdatePanel refreshes but not sure how to do that. 

    Hi dlchase,

    Thanks for your post.

    For executing a javascript function after updatepanel partial refresh page, I suggest you using the pageLoad method to complete it.

     <script>
            function pageLoad(sender, args) 
            {
                     //your function here....... 
    
            }
     </script>

    Above function will execute not matter whether full page refresh or partial page refresh.

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 21, 2014 3:52 AM

All replies

  • User-1672470423 posted

    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyFun1", "disp_confirm();", true);

    replace disp_confirm() javascript function with your function.

    http://www.codeproject.com/Questions/443131/Call-to-javascript-Function-from-code-behind-using

    Monday, May 19, 2014 2:21 PM
  • User1510859543 posted

    Did not work.  I am losing all me entered values on the InsertItemTemplate when the code-behind runs.

    Monday, May 19, 2014 3:27 PM
  • User-417640953 posted

    We have a ListView inside an UpdatePanel and want to be able to run a javascript function AFTER the UpdatePanel refreshes but not sure how to do that. 

    Hi dlchase,

    Thanks for your post.

    For executing a javascript function after updatepanel partial refresh page, I suggest you using the pageLoad method to complete it.

     <script>
            function pageLoad(sender, args) 
            {
                     //your function here....... 
    
            }
     </script>

    Above function will execute not matter whether full page refresh or partial page refresh.

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 21, 2014 3:52 AM