I have a page that does ASP.NET ajax postbacks using UpdatePanels. In some javascript, I set up some objects in the window.onload event, which works great. When I do a postback though, it seems like my objects are messed up.
One object which was receiving events from a table, is no longer receiving the events. I also had a case where objects which has local references to buttons wouldn't be able to update them. Here's the button javascript that was getting messed up:
function EditItemPage(clientId)
{
this.saveButton = $get(clientId + ""_{2}"")
this.publishButton = $get(clientId + ""_{3}"")
this.exitButton = $get(clientId + ""_{4}"")
EditItemPage.prototype.GoDirty = function()
{
//it works if i add these, but i'd rather not have to.
this.saveButton = $get(clientId + ""_{2}"")
this.publishButton = $get(clientId + ""_{3}"")
this.exitButton = $get(clientId + ""_{4}"")
this.saveButton.disabled = false;
this.publishButton.value = 'Save and Publish';
this.exitButton.value = 'Discard changes and Exit';
}
}
So after I do a postback, the button references are messed up unless i reset them as I did in the GoDirty() function.
Any insight?