3
Answers

asp hidden field not retaining values after postback

Hi.
 
I have a webpage (say W) that is displayed inside an iframe of a main page (say M) .
 
All the below events are in the webpage (W). 
I calculate the gridview total using jquery and store it in a hidden variable. 
I then take the value in code behind from this hidden variable for further calculations on button click. 
 
 This process works neatly when i run the webpage separately.
But when its inside the main page (M), the hidden fields do not retain their values and i get error.
 
 jquery is as follows
 
function TotalTC() {
var txtTotal = 0;
$(".TCTotal").each(function () {
txtTotal += isNaN(parseFloat($(this).html())) ? 0 : parseFloat($(this).html());
});
$('.calTCTotal').html(txtTotal.toFixed(2));
$('#gvToolingCost_hdnTCTotal').val(txtTotal.toFixed(2));
}
 
 
inside buttonclick
 
string hdnAmtTotal = (gvCostWorking.FooterRow.FindControl("hdnAmtTotal") as HiddenField).Value;
this value is blank.
 
Thanks in advance.....
 
Answers (3)