I have a Page with an update panel, in this update panel I have a button that I want to show/hide by outputting JavaScript given some params, I am using for example:
RegisterStartupScript(Me.Page, Me.GetType(),
"deleteHideScript", "$('.deleteButton').hide();", True)
I am able to run the $('.deleteButton').hide(); bit in the console and get the desired effect. I am also able to output a script in the same way to console.log('imHere'); and get the expected behavior.
What am I missing?
Partial rendering is the problem. You can’t register a startup script to show an alert after an asynchronous postback. You’ll have to find another way of achieving the same effect, or perform a full postback when you need to display the alert.
You can try setting
EnablePageHeadUpdate="true", but I can’t guarantee that will have any effect.EDIT
Because of partial rendering, the script is run before the button is rendered, which is causing your issue. If you can find a way to render the button before the script is executed, you should be all set.