Given the name, I'm assuming
label_Amount
(or is it
lbl_Amount
?) is an
<asp:Label>
control. That will render a
<span>
, not an
<input>
, so
$("input[id*=lblAmount]")
won't find anything.
You'll also need to scope your selectors to the table row you're processing, and skip the header and footer row(s).
Try:
function CalculationTotal() {
var grid = document.getElementById("<%= gv_PurchaseDetails.ClientID %>");
$(grid).find("tbody > tr").each(function(){
var rate = $("input[id*=txt_Rate]", this);
var qty = $("input[id*=txt_Quantity]", this);
var totalAmount = rate.val() * qty.val();
$("span[id*=lbl_Amount]", this).text(totalAmount.toString());
});
}