private void LoadAddFormControl() { Project bizProject = new Project(); bizProject.Get(Int32.Parse(ProjectId)); //if (bizProject.RecordCount > 0) if (!bizProject.IsEmpty) { if (bizProject[Project.AdditionalFormNames].ToString() == "Project Proposal") { addFormControl = (ProjectMgmtAddFormBaseControl)this.LoadControl("Controls/ProjectApprovalEditor.ascx"); EditorHolder.Controls.Add(addFormControl); } else { String strGIField = Request.QueryString["GIField"]; if (String.IsNullOrEmpty(strGIField) || strGIField.Equals("false")) { addFormControl = (ProjectMgmtAddFormBaseControl)this.LoadControl("Controls/LetterOfIntentEditor.ascx"); } else { addFormControl = (ProjectMgmtAddFormBaseControl)this.LoadControl("Controls/LetterOfIntentEditorGI.ascx"); } EditorHolder.Controls.Add(addFormControl); } } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); this.EnableViewState = true; if (!string.IsNullOrEmpty(ProjectId)) { projectId = Int32.Parse(ProjectId); //ProjectLetterOfIntent biz = new ProjectLetterOfIntent(); //biz.GetByParent(projectId); //if (biz.RecordCount <= 0) // return; var lois = BusinessObject.GetByParent <ProjectLetterOfIntent>(projectId); if (lois.Count() == 0) { return; } ProjectLetterOfIntent biz = lois.First(); if (!string.IsNullOrEmpty(Request.QueryString["field"])) { //LOIField.Field = Request.QueryString["field"]; strLOIField = Request.QueryString["field"]; if (!IsPostBack) { LOIField.Text = biz[strLOIField].ToString(); } } string strControlName = Request.QueryString["ControlName"]; if (!String.IsNullOrEmpty(strControlName)) { addFormControl = (ProjectMgmtAddFormBaseControl)LoadControl(this.ResolveUrl("Controls//" + strControlName)); DynamicControlHolder.Controls.Add(addFormControl); int loiId = Int32.Parse(biz[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString()); if (!IsPostBack) { addFormControl.Populate(loiId); } } } }