Here are some code snippets

Here are some code snippets which I used to load usercontrols dynamically
–The way to load
protected override void OnInit(System.EventArgs e)
{
// Add the header and footer controls
header hdr = (header) LoadControl(“/include/Header.ascx”);
if(hdr!=null)
{
hdr.AppTitle = mySettings[“ApplicationTitle”].ToString();
hdr.ID = “header”;
this.Controls.AddAt(0,hdr);
}

–The way to find
//_ctl0_lblTitle
header hdr = (header) this.FindControl(“header”);
if(hdr!=null)
{
hdr.PageTitle = value;
}

Leave a comment