如何访问用户控件属性 [英] How to access Usercontrol Properties
本文介绍了如何访问用户控件属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.
这是我的问题...
我有2个标签的用户控件
我想访问父页面代码背后的标签之一的text属性,该标签使用usercontrol我该怎么做?
HI guys..
here is my question...
I have a usercontrol with 2 lables
I want to access the text property of one of the lable in my codebehind of parent page which uses usercontrol how do I do that??
推荐答案
属性... get /放... !?希望这样就足够了.
Properties...get/set... !? Hope that should be enough.
听起来好像标签不允许公共访问,在设计视图中默认情况下将其设置为private.您可能需要为标签创建一个获取/设置:
It sounds like the label does not allow public access, by default in design view it is set to private. You probably need to create a get/set for the label:
public label lYourLabel { get; set; }
检查子控件的可访问性
这篇关于如何访问用户控件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文