如果你的*.cs并不是*.aspx的CodeBehind文件的话,就必须把控件通过参数传递过去才能用。

解决方案 »

  1.   

    我也一直在苦恼这个问题!先写脚本,再通过IsClientScriptBlockRegistered倒是可以调用客户端程序!但肯定不是好方法!期待高手指点!
    帮你也帮自己up一下!
      

  2.   

    to:jackyhx(飞不动的侠)
    我刚试过,用FindControl(ctrId)只能操作服务器端的控件,如果是客户端的话,好像不行,但大多数OBJECT对象都是客户端控件,不知有没有其它的方法操作?
    to: icyer() 
    能不能给点代码看看!
      

  3.   

    icyer():
    能不能给点代码看看!
    谢谢!!!
      

  4.   

    to yxrj() :
    比如说,我想实现按一个按钮就开始用MEDIAPLAYER播放指定的MUSIC文件的功能,但是因为MEDIAPLAYER是OBJECT 控件,不是服务 控件,所以我总是引用不了。Would you help me????
      

  5.   

    不知道object控件能不能 runat="server",如果可以是可以用了
      

  6.   

    object 有runat=server属性,看下面例子:
    <html>
    <BODY>
    <OBJECT class="System.Collections.ArrayList" id="items" runat="server" VIEWASTEXT>
    </OBJECT>
    <script language="C#" runat="server">      
    void Page_Load(Object sender, EventArgs e)       
    {         
    items.Add("1");         
    items.Add("2");         
    items.Add("3");         
    MyList.DataSource = items;       
    MyList.DataBind();      
    }
    </script>
    <asp:datalist id="MyList" runat="server">
    <ItemTemplate>
    这里有一个值:<%# Container.DataItem %>
    </ItemTemplate>
    </asp:datalist>
    </BODY>
    </html>可是我把Page_Load放到aspx.cs文件里就不行了,说找不到items,
    好像object还是在客户端。
      

  7.   

    <object >都可以通过id 属性和runat=server传到codebehind.
    ,但是,传到之后,id.方法()却没有我们需要的那种,我比个例
    是media player的话(没有相应的支持驱动media player)我由找不到
    什么绕过去的方法,现在逼着我不用动态点播。
    有什么好办法,大家up up把。
     
      睡不着觉,特来关税
      

  8.   

    我看了一下文档,没办法,确实不能用!
    看MSDN的说明:
    Res
    When the ASP.NET page parser encounters a server-side object tag in an .aspx file, it generates a read-only property on the page, using the id attribute of the tag as the property name. The read property is then configured to create an instance of the object on first use. 
    //看这一句
    The resulting instance is not added as an object within the page's hierarchical server control tree; it is instead treated as a non-UI variable declaration.
    //因为object在页控件里面不存在,所以id.方法()不能调用The classid, progid, and class attributes are mutually exclusive. You cannot include more than one of these attributes in a single server-side object tag. You can, however, include multiple server-side object tags on a Web Forms page and use these attributes in different tags.
      

  9.   

    js<object name="me" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="MediaPlayer1" width="450" height="400">
    ....
    </object>
    <input onclick="me.Filename='http://xxx.xx/xx.mpg';">