Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/412.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ScriptManager从c#调用客户端脚本的EPiServer_C#_Javascript_Client Side_Scriptmanager_Episerver - Fatal编程技术网

使用ScriptManager从c#调用客户端脚本的EPiServer

使用ScriptManager从c#调用客户端脚本的EPiServer,c#,javascript,client-side,scriptmanager,episerver,C#,Javascript,Client Side,Scriptmanager,Episerver,当使用EPiServer调用客户端函数时,由于EPiServer接管ScriptManager的方式,需要特定的语法 如果您正在为EPiServer项目编写代码,请使用以下方法: System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "myFunction", "myFunction()", true); 其中“myFunction”是客户端函数的名称 另外:请记住,您的函数需要定义在服务器端代码可以获取

当使用EPiServer调用客户端函数时,由于EPiServer接管ScriptManager的方式,需要特定的语法

如果您正在为EPiServer项目编写代码,请使用以下方法:

System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "myFunction", "myFunction()", true);
其中“myFunction”是客户端函数的名称


另外:请记住,您的函数需要定义在服务器端代码可以获取的位置,因此我建议将其放在全局命名空间中。

这是一个问题吗?:)不,它只是有用的代码,但不确定还要放在哪里才能帮助人们。好吧!:)如果您想发布有用的代码片段,可以在episerverworld上找到一个部分:干杯!