如何从页面调用用户控件内部的控件
问题描述:
人们
我在用户控件中有一个下拉菜单,例如"CountryUserControl".我有另一个用户控件来显示基于该国家/地区的表单,例如"FormDetailUserControl".现在,这两个用户控件被添加到ASPX页面中.
I have a drop down in a user control say "CountryUserControl". I have another user control to display a form based on the selection of this country say "FormDetailUserControl". Now these TWO user controls are added up to a ASPX page.
我想知道如何访问下拉菜单并从ASPX页面获取该值.
I want to know how to access the drop down and get the value of that from the ASPX page.
答
您可以在用户控件中将嵌入式控件公开.我会创建一个公共属性来检索其值.
You could make the embedded control public in the user control. I would create a public property to retrieve its value instead.