简体   繁体   English

如何在后面的代码中访问对象?

[英]How to access an object in code behind?

I have created an object using the object tag as below: 我已经使用object标签创建了一个对象,如下所示:

< object id="video1" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
        codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
        width="640" height="480"  >               
        < /object >

I want to access this in the code behind in the .aspx.cs,but currently it is inaccessible.How should this be done? 我想在.aspx.cs后面的代码中访问此文件,但目前无法访问。该怎么办?

you can add attribute runat="server" to your object to get it accessible from code behind. 您可以将属性runat="server"添加到对象中,以使后面的代码可以访问它。

EDIT: You need to remove the extra clsid value in the classid parameter value. 编辑:您需要在classid参数值中删除多余的clsid值。

Try This: 尝试这个:

<object id="video1" runat="server" classid="9BE31822-FDAD-461B-AD51-BE1D1C159921"
 codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
 width="640" height="480"></object>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM