Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/310.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
C# 在pageload上从codebehind调用内联Javascript_C#_Javascript_Asp.net - Fatal编程技术网

C# 在pageload上从codebehind调用内联Javascript

C# 在pageload上从codebehind调用内联Javascript,c#,javascript,asp.net,C#,Javascript,Asp.net,我的asp.net页面上有一个Javascript块: <script type="text/javascript"> Sys.debug = true; var popup; Sys.require(Sys.components.popup, function () { popup = Sys.create.popup("#popup", { parentElementID: "target", });

我的asp.net页面上有一个Javascript块:

<script type="text/javascript">
    Sys.debug = true;
    var popup;
    Sys.require(Sys.components.popup, function () {
        popup = Sys.create.popup("#popup", {
            parentElementID: "target",
        });
    });
</script>

您可以在MSDN上找到此问题的帮助:

尝试以下方法:

ClientScript.RegisterStartupScript(this.GetType(), "sample", "<script 
    type="text/javascript">Sys.debug = true;var popup;Sys.require(Sys.components.popup,
    function () {popup = Sys.create.popup("#popup", {parentElementID: "target",});});
    </script>",false);
ClientScript.RegisterStartupScript(this.GetType(),“sample”,“Sys.debug=true;var popup;Sys.require(Sys.components.popup,
函数(){popup=Sys.create.popup(“#popup”,{parentElementID:“target”,});});
“,假);
一种呼叫方式:

Page.ClientScript.RegisterStartupScript(this.GetType(),“key”,“xyz();”,true); 将JavaScript保存在函数中

ClientScript.RegisterStartupScript(this.GetType(), "sample", "<script 
    type="text/javascript">Sys.debug = true;var popup;Sys.require(Sys.components.popup,
    function () {popup = Sys.create.popup("#popup", {parentElementID: "target",});});
    </script>",false);