Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When you use UpdatePanel, after the post back the DOM (struct of html and elements) has change and the javascript that you have setup, need to initialize again. For this reason UpdatePanel offer this javascript functionality.</p> <pre><code>var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(InitializeRequest); prm.add_endRequest(EndRequest); function InitializeRequest(sender, args) { } function EndRequest(sender, args) { } </code></pre> <p>Now on the EndRequest you need to re-initialize your javascript. Your final javascript will be</p> <pre><code> function InitCalculus() { // For GridView Calculation $("[id*=grdItems]input[type=text][id*=txtCalc]").live("keyup", function(e) { var quantity = $(e.target).closest('tr').find("input[type=text][id*=txtCalcQuantity]").val(); var price = $(this).closest('tr').find("input[type=text][id*=txtCalcUnitPrice]").val().replace(/,/g, ''); var actprice = $(this).closest('tr').find("input[type=text][id*=txtCalcActUnitPrice]").val().replace(/,/g, ''); var total = parseFloat(price) * parseInt(quantity); var acttotal = parseFloat(actprice) * parseInt(quantity); if (isNaN(total)) total = 0; $(e.target).closest('tr').find("[id*=lblAmount]").text(total.toFixed(2)); $(e.target).closest('tr').find("[id*=hfAmount]").val(total); if (isNaN(acttotal)) acttotal = 0; $(e.target).closest('tr').find("[id*=lblActAmount]").text(acttotal.toFixed(2)); $(e.target).closest('tr').find("[id*=hfActAmount]").val(acttotal); GrossTotal(); GrossActTotal(); }); } // you can run this onload page, I just place it here to simulate your code InitCalculus(); var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(InitializeRequest); prm.add_endRequest(EndRequest); function InitializeRequest(sender, args) { } function EndRequest(sender, args) { InitCalculus(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload