如何调用用户控件里的空件(新手急求) 做了一个用户控件 里面有一个图片框,一个文本框在另一个界面a中放置了若干个该用户控件操作:想为界面a中的用户控件中的图片框,文本框负值,如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、在用户控件中加以下代码public string haha{ get { return this.文本框.Text; } set { this.文本框.Text = value; }} 2、页面a首先引用用户控件 protected test Test2; //Test2为我的用户控件名3、页面a中用户控件写值 Test2.haha = "你想要的值"; 在用户控件b中设置属性我做了在页面a中引用和负值有问题,其中c为用户控件在界面a中的名字protected c b;c.haha 无效,找不到 protected c b;c.haha 无效,找不到----->protected b c; 例如你的用户控件名为abcd.ascx,则写protected abcd c; 我的用户控件名为UserControl.cx,则写protected UserControl c;有问题,语句无效 不会啊,例如我的代码:ASPX页面:<body MS_POSITIONING="GridLayout"><form id="Form1" method="post" runat="server"> <FONT face="宋体"> <uc1:test id="Test2" runat="server"></uc1:test> <uc1:test id="Test3" runat="server"></uc1:test> <uc1:UserControl id="UserControl1" runat="server"></uc1:UserControl></FONT> </form></body>CS代码:public class testbb : System.Web.UI.Page{ protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button Button2; protected test Test2; protected test aa; protected UserControl 我喜欢的名字; ........} 我用的不是asp.net,是c#.net是不是有区别阿 controls 集合 或者将控件对象公开。 参考这里的文章解决问题,http://blog.csdn.net/zhzuo/archive/2004/04/05/22027.aspxhttp://blog.csdn.net/zhzuo/archive/2006/05/05/708941.aspx 怎么能把这段代码做成类 一个应用程序怎么去引用另一个应用程序的命名空间? 请教C#创建IIS虚拟路径的问题 程序自己退出 请问如何当前输入是键盘输入的还是远程桌面模拟输入的?如何让输入框不被HOOK拦截? 有没有代码分析的源代码 有关ifram的问题 教材用什么播放器能用图文的感觉 C# 谁能提供一个新闻上一篇、下一篇的代码,谢谢 初学VC#,有些地方不太明白。 textBox 如何禁止粘贴? 怎样查询数据库中表的字段的名称阿?
public string haha
{
get
{
return this.文本框.Text;
}
set
{
this.文本框.Text = value;
}
} 2、页面a首先引用用户控件
protected test Test2; //Test2为我的用户控件名3、页面a中用户控件写值
Test2.haha = "你想要的值";
在页面a中引用和负值有问题,其中c为用户控件在界面a中的名字
protected c b;
c.haha 无效,找不到
c.haha 无效,找不到
----->
protected b c; 例如你的用户控件名为abcd.ascx,则写protected abcd c;
有问题,语句无效
ASPX页面:<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<uc1:test id="Test2" runat="server"></uc1:test>
<uc1:test id="Test3" runat="server"></uc1:test>
<uc1:UserControl id="UserControl1" runat="server"></uc1:UserControl>
</FONT>
</form>
</body>CS代码:
public class testbb : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected test Test2;
protected test aa;
protected UserControl 我喜欢的名字;
........
}
是不是有区别阿
http://blog.csdn.net/zhzuo/archive/2004/04/05/22027.aspx
http://blog.csdn.net/zhzuo/archive/2006/05/05/708941.aspx