[英]Javascript is not working when used with UpdatePanel
I placed the following code in two pages. 我将以下代码放在两页中。
Anybody know what should I do to execute the same in context of Case 2 . 任何人都知道在情况2的情况下我应该怎么做才能执行相同的操作。
StringBuilder jScript = new StringBuilder();
jScript.Append("<script type='text/javascript'>");
jScript.Append("Sys.WebForms.PageRequestManager.getInstance().add_endRequest(AlertMe);");
jScript.Append("function AlertMe() {");
jScript.Append(" alert('Hi Hoo')");
jScript.Append("}");
jScript.Append("AlertMe();");
jScript.Append("</script>");
Page.ClientScript.RegisterStartupScript(typeof(string), "save_as", jScript.ToString());
i am not sure i understand you right, but may be you are searching for function 我不确定我是否理解正确,但是可能您正在寻找功能
ScriptManager.RegisterStartupScript() ScriptManager.RegisterStartupScript()
because Page.ClientScript is obsolete now, and it's function "RegisterStartupScript" does not work with update panels async postbacks. 因为Page.ClientScript现在已过时,并且它的功能“ RegisterStartupScript”不适用于更新面板异步回发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.