Finding a control can do the job, but it's not a good practice. If you ever change the identifier of a control in the markup, the compiler will not catch it, avoid using the system at all costs; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
WebApplication5 namespace {
public class Uc2: UserControl
{
private Uc3 _uc3;
public Uc3 Uc3
{
get { return _uc3; }
}
}
public class Uc3 : UserControl
{
}
public class Uc1 : Uc2
{
public Uc1()
{
Uc3 uc3 = this.Uc3;
Uc3 uc3_interface = ((IUc3)Page).Uc3;
}
}
public interface IUc3
{
Uc3 Uc3 { get; }
}
public class PageContainer : Page, IUc3
{
private Uc2 _uc2;
public Uc3 Uc3
{
get { return _uc2.Uc3; }
}
}
}
Sid c source
share