How can I load a control without a Page?
public void Something()
{
var ascx = /*LoadControl*/("my.ascx"); // being Page = null
var ctl1 = ascx.Controls[0];
var ctl2 = ascx.Controls[1];
}
my.ascx:
<%@ Control Language="C#" %>
<asp:Literal ID="ctl1" runat="server" />
<asp:Label ID="ctl2" runat="server" />
You can get your Page-Object from HttpContext in this way: