繁体   English   中英

无法从后端触发JavaScript

[英]Failed to trigger javascript from backend

我只是从vb编码转换为c#,所以我有很多事情要赶上,请在这1方面为我提供帮助。

我在aspx页面上有一个javascript函数,我想从后端触发该函数。

下面是我在后端的代码。

ScriptManager.RegisterStartupScript(this, this.GetType(), "closeScript", "showMessage('test')", true);

不幸的是我遇到了如下错误。

Error   30  Keyword 'this' is not valid in a static property, static method, or static field initializer.

请帮忙。

尝试从PageLoad方法执行此操作

用这个

    ClientScript.RegisterClientScriptBlock(this.GetType(), "closeScript", "showMessage('test')", true);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM