Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.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# 非静态方法或字段错误需要对象_C#_Jwplayer - Fatal编程技术网

C# 非静态方法或字段错误需要对象

C# 非静态方法或字段错误需要对象,c#,jwplayer,C#,Jwplayer,有 非静态字段、方法或对象需要对象引用 属性“System.Web.UI.Page.ClientScript.get” 指定行中出现错误。如何修复?假设此代码来自页面本身,请尝试此操作 Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; ///Broken line if (!cs.IsStartupScriptRegistered(cstype, "load

非静态字段、方法或对象需要对象引用 属性“System.Web.UI.Page.ClientScript.get”


指定行中出现错误。如何修复?

假设此代码来自页面本身,请尝试此操作

Type cstype = this.GetType();


        ClientScriptManager cs = Page.ClientScript;  ///Broken line


        if (!cs.IsStartupScriptRegistered(cstype, "loadvideo"))
        {
            StringBuilder cstext3 = new StringBuilder();
            cstext3.Append("jwplayer(\"vidplayer\").setup({");
            cstext3.Append("flashplayer:\"./players/player.swf\",");
            cstext3.Append("file: \"");
            cstext3.Append("./video.mp4");
            cstext3.Append("\",height: 270,");
            cstext3.Append("width: 400");
            cstext3.Append("});");
            cs.RegisterStartupScript(cstype, "loadvideo", cstext3.ToString(), true);

假设此代码来自页面本身,请尝试以下操作

Type cstype = this.GetType();


        ClientScriptManager cs = Page.ClientScript;  ///Broken line


        if (!cs.IsStartupScriptRegistered(cstype, "loadvideo"))
        {
            StringBuilder cstext3 = new StringBuilder();
            cstext3.Append("jwplayer(\"vidplayer\").setup({");
            cstext3.Append("flashplayer:\"./players/player.swf\",");
            cstext3.Append("file: \"");
            cstext3.Append("./video.mp4");
            cstext3.Append("\",height: 270,");
            cstext3.Append("width: 400");
            cstext3.Append("});");
            cs.RegisterStartupScript(cstype, "loadvideo", cstext3.ToString(), true);
Page.ClientScript不是静态属性,因此不能以这种方式使用它。假设您有一个名为pageInstance的页面实例,该实例可以在方法中访问,请改用以下方法:

ClientScriptManager cs = this.ClientScript;  ///Broken line
Page.ClientScript不是静态属性,因此不能以这种方式使用它。假设您有一个名为pageInstance的页面实例,该实例可以在方法中访问,请改用以下方法:

ClientScriptManager cs = this.ClientScript;  ///Broken line

您正在尝试将播放机嵌入Windows phone应用程序或其他内容吗?您正在尝试将播放机嵌入Windows phone应用程序或其他内容吗?谢谢您的回答,但我现在收到了此错误。当前上下文中不存在名称“pageInstance”。应将“pageInstance”替换为页面实例的变量名。谢谢。现在没有错误。我有个问题。我该如何把它写进表格中。我想在此表单中运行jwplayer。谢谢您的回答,但我现在遇到了这个错误。当前上下文中不存在名称“pageInstance”。应将“pageInstance”替换为页面实例的变量名。谢谢。现在没有错误。我有个问题。我该如何把它写进表格中。我想在这个表单中运行jwplayer。