How to access on of the Control in Page from the UserControl?

Posted by dewacorp.alliances on Stack Overflow See other posts from Stack Overflow or by dewacorp.alliances
Published on 2010-06-08T06:00:14Z Indexed on 2010/06/08 6:02 UTC
Read the original article Hit count: 123

Filed under:

Hi there

How do I access the Control (dropdownlist) in current Page from the UserControl?

In the UserControl:

String test = ((DropDownList)this.Parent.FindControl("drpdwnlstMainRegion")).SelectedValue;

It return null on ((DropDownList)this.Parent.FindControl("drpdwnlstMainRegion")) for some reason?!?!

BTW ... I am using ASP.NET C# 3.5.

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET