In the function below, the code should take a parameter,
1) display an alert with the parameter value
2) save the value to a hidden field
3) display an alert with the value read from the hidden field.
Step 1 works. I can’t confirm Step 2 is occuring and Step 3 returns ‘undefined’.
The first alert shows the correct ID – the ID passed to SaveReportId().
The second alert shows “SaveReportId() after save: undefined”
function SaveReportId(selectedReportId) {
alert('SaveReportId() before save: ' + selectedReportId);
$('#HiddenReportId').val(selectedReportId);
alert('SaveReportId() after save: ' + $('#HiddenReportId').val());
}
HTML:
<div class="hiddenValues">
<input id="HiddenReportId" type="hidden" runat="server" class="HiddenReportId" />
</div>
The hidden field had a runat=”server” attribute. I removed it and the code runs fine…