private void AddUserControl() { string UserControlName = "WebUserControl" + Request.Params["UC"] + ".ascx"; ClassTMSUserControl TempControl = LoadControl(UserControlName) as ClassTMSUserControl; TempControl.ID = "ThisControl" + Request.Params["UC"]; PlaceHolderEmbeddedControl.Controls.Add(TempControl); }
protected void Page_PreRender(object sender, EventArgs e) { if (Request.Params["Id"] != null) { ClassTMSUserControl TempControl = PlaceHolderEmbeddedControl.FindControl("ThisControl" + Request.Params["UC"]) as ClassTMSUserControl; if ((TempControl != null) && (TempControl.KeyID != Guid.Parse(Request.Params["Id"]))) { // make sure the data is loaded TempControl.KeyID = Guid.Parse(Request.Params["Id"]); //TempControl.KeyID; if (TempControl.RefreshRequired) { TempControl.Visible = false; } } } }