Skip to main content

Posts

Showing posts from December, 2013

Deregistering ResgisterStartupScript

Yesterday was bit tricky until I found my solution to deregister the Startup script; we used to bind from code behind in asp.net. I have added the script using sys.application.add_load(); to show a simple popup but the problem is when an asyn postback happens again and again those alerts pops out ;). After few mins of googling found a solution from Microsoft support link that we can remove the handler using sys.application.remove_load(); Though the solution is not exactly deregistering, it still solves the problem. If you have any other solution for this, please post the same in comments. I have done with scriptmanager since the postback was through updatepanel. Code:  ScriptManager.RegisterStartupScript(updatePanelID, this.GetType(), "key",                  "Sys.Application.remove_load(jsMethodName);", true);