Javascript and Postback problem
I have a button when i click it, some text from a textbox is got and written inside a p tag via javascript. I have another button that ca开发者_运维问答use page postback. But after postback, contents which added by javascript are disappearing.
Is there a way to solve this problem ?
Either use ajax to postback part of the page excluding the part you change with javasciprt or store the changes in a formfield so that they can be remade after postback.
Clientside javascript changes are not visible to the server and will disapear efter postback since the page is renderd from start again.
If you're using C# and ASP .NET, try using server-side controls and functions instead of javascript. These preserve their state during postback.
Or do you really must use javascript?
You can use ajax Update panel to partial post back the page on buton click
精彩评论