难道当一个局部回传叫ClientScriptmanager工作? [英] Does the ClientScriptmanager work when called in a partial postback?

查看:107
本文介绍了难道当一个局部回传叫ClientScriptmanager工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想关闭浏览器窗口时,ASP.NET运行成功。在code以下信息由驻留在一个Ajax的UpdatePanel一个按钮来触发。

  Page.ClientScript.RegisterClientScriptBlock(typeof运算(LeaveApproval),ShowSuccess,<脚本语言= JavaScript的> window.opener =自我; self.close();< /脚本>中);
 

然而,这code似乎没有产生任何影响。该窗口未关闭。当我输入的JavaScript到我的浏览器的地址栏能正常工作,所以我猜这事做与使用ClientScriptManager与阿贾克斯。

知不知道我做错了吗?

解决方案

斯科特Klueppel此链接帮我解决了问题...

而使用...

  ScriptManager.RegisterStartupScript
 

而不是

  Page.ClientScript.RegisterClientScriptBlock。
 

I would like to close the browser window when an ASP.NET operation has succeeded. The code below is triggered by a button that resides in an Ajax UpdatePanel.

Page.ClientScript.RegisterClientScriptBlock(typeof(LeaveApproval), "ShowSuccess", "<script language=javascript>window.opener=self; self.close();</script>");

However, this code does not seem to have any effect. The window is not closed. When I enter the javascript into the URL bar of my browser it works fine, so I'm guessing this has something to do with using the ClientScriptManager together with Ajax.

Any idea what I am doing wrong?

解决方案

This link by Scott Klueppel helped me solve the problem...

Rather use...

ScriptManager.RegisterStartupScript

instead of

Page.ClientScript.RegisterClientScriptBlock.

这篇关于难道当一个局部回传叫ClientScriptmanager工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆