[英]Failed to trigger javascript from backend
I just switch from coding in vb to c#, so I've got a lot of things to catch up and please assist me on this 1. 我只是从vb编码转换为c#,所以我有很多事情要赶上,请在这1方面为我提供帮助。
I have a javascript function on aspx page, and I would like trigger the function from backend. 我在aspx页面上有一个javascript函数,我想从后端触发该函数。
Below is my code at backend. 下面是我在后端的代码。
ScriptManager.RegisterStartupScript(this, this.GetType(), "closeScript", "showMessage('test')", true);
Unfortunately I got an error as below. 不幸的是我遇到了如下错误。
Error 30 Keyword 'this' is not valid in a static property, static method, or static field initializer.
Please help. 请帮忙。
尝试从PageLoad方法执行此操作
用这个
ClientScript.RegisterClientScriptBlock(this.GetType(), "closeScript", "showMessage('test')", true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.