如何从UserControl访问当前页面中的Control(下拉列表)?如何从UserControl访问页面中的控件?
在用户控件:
String test = ((DropDownList)this.Parent.FindControl("drpdwnlstMainRegion")).SelectedValue;
或
String test = ((DropDownList)this.Page.FindControl("drpdwnlstMainRegion")).SelectedValue;
它在((DropDownList的)this.Parent.FindControl( “drpdwnlstMainRegion”))由于某种原因,返回null?!?!
顺便说一句...我使用ASP.NET C#3.5。
感谢