你可以试试这个。
ScriptManager.RegisterClientScriptBlock(Page,this.GetType(), Guid.NewGuid().ToString(), "Sys.Application.add_load( function(){ Mret.FormInputControl._setText(" + string.Format(CultureInfo.InvariantCulture, "'{0}','{1}'", this.ID, TextHeader) + ")});", true);
以下是从后面的代码调用 javascript 函数的不同方式
解决方案 1:
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Hello');", true);
解决方案 2:
ScriptManager.RegisterStartupScript(Page,this.GetType(), "alert", "alert('Hello');", true);
解决方案 3:
ScriptManager.RegisterClientScriptBlock(Page,this.GetType(), "alert", "alert('Hello');", true);