This is a migrated thread and some comments may be shown as answers.

[Solved] Persist Javascript Changes over Postback

2 Answers 248 Views
Input
This is a migrated thread and some comments may be shown as answers.
Baatezu
Top achievements
Rank 2
Baatezu asked on 22 May 2008, 01:29 AM
I do a bunch of javascript calculations setting the values in some radNumericTextBoxes, and when I do a postback (I need to upload files) the values are reset to default values.
I am wondering if there is a way I could have the changes persist through the postback. The data I enter manually stays through postback, but not the java stuff.

Thanks

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 22 May 2008, 09:46 AM
Hi Baatezu,

JavaScript is a client-side scripting language that allows dynamic behavior to be specified within HTML documents and as such it is "executed" on the client (using its browser) and is not automatically persisted upon postback, as the server is not aware of the changes made through javascript. The data you enter manually is persisted because we persist it in ViewState and send it to the server. You can do the same by using a hidden input to save the values you have before postback.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Baatezu
Top achievements
Rank 2
answered on 23 May 2008, 01:46 AM
That makes sense.
Since it looks like I'd have to do some javascript to re-assign the values to the boxes when the page re-loads (was hoping to avoid the javascript) I will set it up so that the javascript functions I use to calculate are called when the page loads.

Tags
Input
Asked by
Baatezu
Top achievements
Rank 2
Answers by
Steve
Telerik team
Baatezu
Top achievements
Rank 2
Share this question
or