如果你的*.cs并不是*.aspx的CodeBehind文件的话,就必须把控件通过参数传递过去才能用。
解决方案 »
- Gridview编辑状态下针对整行有编辑模板吗
- HyperLink控件链接到文件时,如何在点击后弹出“打开”“保存”“取消”对话框?
- 网站上传数据库部署问题
- 请问如何保留JS 动态给masterpage中某个控件赋的值
- datagrid的取值问题
- 关于xml的dom的一段代码,请大家帮忙改改!
- 数据提供者和ADO,OLEDB,RDO,DAO,ODB,ADO.NET接口有何区别?
- 各位有没有办法 把sql 提出的金额 字段 这样显示 233,434.10 整数部分 每隔三位就用 逗号隔开
- 请问如何手工注册从网上下载的ActiveX控件?
- 不行!!不行!!各位大侠给我看看(在线等)
- icyer()老大和各位高手,我该怎么做那???
- 请问如何在对DATAGRID进行删除操作时跳出确认框?很急,不好意思
帮你也帮自己up一下!
我刚试过,用FindControl(ctrId)只能操作服务器端的控件,如果是客户端的话,好像不行,但大多数OBJECT对象都是客户端控件,不知有没有其它的方法操作?
to: icyer()
能不能给点代码看看!
能不能给点代码看看!
谢谢!!!
比如说,我想实现按一个按钮就开始用MEDIAPLAYER播放指定的MUSIC文件的功能,但是因为MEDIAPLAYER是OBJECT 控件,不是服务 控件,所以我总是引用不了。Would you help me????
<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还是在客户端。
,但是,传到之后,id.方法()却没有我们需要的那种,我比个例
是media player的话(没有相应的支持驱动media player)我由找不到
什么绕过去的方法,现在逼着我不用动态点播。
有什么好办法,大家up up把。
睡不着觉,特来关税
看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.
....
</object>
<input onclick="me.Filename='http://xxx.xx/xx.mpg';">