簡體   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