我有许多现有的脚本需要调试,这些脚本都是从代码后台嵌入的。
我更喜欢使用Visual Studio 2008客户端调试功能,但断点只能在aspx文件中的脚本块内设置。
问题在于,我无法在脚本上设置断点,因为它们都是从代码后台文件(而不是aspx文件)注册的。使用ClientScriptManager.RegisterClientScriptBlock Method (Type, String, String, Boolean)将脚本添加到页面中。
以下是一个示例(它没有损坏,只是演示如何将其添加到页面中)。
我更喜欢使用Visual Studio 2008客户端调试功能,但断点只能在aspx文件中的脚本块内设置。
问题在于,我无法在脚本上设置断点,因为它们都是从代码后台文件(而不是aspx文件)注册的。使用ClientScriptManager.RegisterClientScriptBlock Method (Type, String, String, Boolean)将脚本添加到页面中。
以下是一个示例(它没有损坏,只是演示如何将其添加到页面中)。
if (!cs.IsClientScriptBlockRegistered(cstype, csname2))
{
StringBuilder cstext2 = new StringBuilder();
cstext2.Append("<script type=\"text/javascript\"> function DoClick() {");
cstext2.Append("Form1.Message.value='Text from client script.'} </");
cstext2.Append("script>");
cs.RegisterClientScriptBlock(cstype, csname2, cstext2.ToString(), false);
}
是否有可能在不必将测试页面中的每个脚本都拿出来的情况下进行调试?
编辑:谢谢