How can I use firebug to debug javascript ran using ScriptManager.RegisterStartupScript
Since these scripts aren't loaded on the page in advance, how can I s开发者_JAVA百科et breakpoints in them to watch what's going on.
Not really answering your question but you should avoid putting complex javascript in your codebehind and not mix client and server languages. At best you should limit yourself to a function call on the server but the actual implementation will be inside a separate javascript function inside a separate javascript file. This way not only that you will reduce the traffic between the client and the server on each AJAX call but your scripts will be cached:
SomeModelToPassToTheFunction model = ...
string json = new JavaScriptSerializer().Serialize(model);
var script = string.Format("someFunction({0});", json);
ScriptManager.RegisterStartupScript(this, GetType(), "somekey", script, true);
Oh, and now you can place breakpoints inside the function.
精彩评论