• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

ASP.NET capture Client-side textbox value

letsgetsilly

Senior member
I'm running ASP.NET 2.0 web application. I have 2 text boxes, A and B. A is enabled and the B is disabled. B's value is set by the following working javascript to equal 100-A's value:

document.getElementById("B").value = 100-ValueOfA;

I'm unable to use the code behind to grab this value after a postback, and I'm curious as to why not. The textboxes are within the ASP.NET 2.0 Wizard control, which renames the clientside ID's. However, other text boxes I'm able to get the value for that are also in the wizard.

I'm also using an AJAX panel to capture postback.
 
Because it's disabled, it wont submit data upon postback. You probably want to enable it and set it to readonly.
 
Originally posted by: WannaFly
Because it's disabled, it wont submit data upon postback. You probably want to enable it and set it to readonly.

Yup, that's precisely the case. The browser won't post data to the server if the field is disabled. Readonly, on the other hand, it will post.
 
The read-only method did not do it. I've had to calculate the textbox value in the code behind so that it is correctly saved. I couldn't get that vaue to post back either way.
 
Back
Top