Why can't we write a JavaScript code using Response.Write(".....") to serve the same purpose as RegisterStartupScript()?
2 Answers
RegisterStartupScript() will correctly wireup you script when it will be loaded from UpdatePanel. By default, code in UpdatePanel update is not treated as script - this should be done manually or by using RegisterStartupScript().
2 Comments
Ivan Suhinin
Looks like it will be same as Response.Write("...") then. I've disassembled this method in Resharper and seems like it does nothing but registers script for UpdatePanel and generates correct <script> tags. If you will not use UpdatePanel you'll not get any actual benefit.