供大家参考
“我在用户控件中有一个公用的属性和公用的方法,在调用他的页面中可以访问,但是在后置代码文件中确无法访问到这个用户控件。”
http://expert.csdn.net/Expert/topic/1989/1989975.xml?temp=.6281244
“我在用户控件中有一个公用的属性和公用的方法,在调用他的页面中可以访问,但是在后置代码文件中确无法访问到这个用户控件。”
http://expert.csdn.net/Expert/topic/1989/1989975.xml?temp=.6281244
protected YouUserControlClass control1;
tb.Text = "123";>>>2、如何在后台设置和获取用户控件本身的属性?if you have a codebehind class for your usercontrol, you can do
protected YourUserControlCodeBehindClass YourUserControlID;YourUserControlID.Property1 = "123";otherwise, you have to use Reflection
我试了一下,你的方法可以。此问题基本得到了解决。
菜鸟还有些疑问,Usercontrol的功能是不是有些太有限了一点?与内嵌组件相比,无论属性还是方法似乎都不够强大 -_-