G
Guest
I'm using Javascript to change a value in an asp:textbox control on an
asp.net page, then submitting the page and persisting the data using c# code.
I can see the value in the textbox change when the Javascript runs, but when
the page is submitted, the c# event code still sees the original value in the
textbox, not the value that was updated by Javascript.
Here’s the javascript code that changes the value:
document.forms[0].txt1.value = calcCigScore();
alert (document.forms[0].txt1.value);
The alert shows me that the value has changed (I can also see it change on
the page).
And here’s the c# code from the SaveRecord event on the aspx page:
mIntake.CigScore = int.Parse(txt1.Text);
When tracing through the code, I see that txt1.Text still equals the value
that was originally loaded into the page.
Is there a reason why .Net doesn’t see the updated value? Anything I can do
to change that?
Thanks
asp.net page, then submitting the page and persisting the data using c# code.
I can see the value in the textbox change when the Javascript runs, but when
the page is submitted, the c# event code still sees the original value in the
textbox, not the value that was updated by Javascript.
Here’s the javascript code that changes the value:
document.forms[0].txt1.value = calcCigScore();
alert (document.forms[0].txt1.value);
The alert shows me that the value has changed (I can also see it change on
the page).
And here’s the c# code from the SaveRecord event on the aspx page:
mIntake.CigScore = int.Parse(txt1.Text);
When tracing through the code, I see that txt1.Text still equals the value
that was originally loaded into the page.
Is there a reason why .Net doesn’t see the updated value? Anything I can do
to change that?
Thanks