protected void Page_Load(object sender, EventArgs e) { // Works here this.lblAffiantName.Text = this.Affiant; // Extra code removed } protected void Page_PreRender(object sender, EventArgs e) { if (this.ArrestRecord != null) this.DisplayAffiant(); } public void DisplayAffiant() { // Moved to the Page Load, doesn't work here for some reason, lblAffiantName is null //this.lblAffiantName.Text = this.Affiant; // extra code removed } public void SetupAffiant(ArrestEntity entity) { // Store the Arrest Record into the property this.ArrestRecord = entity; // Format and store the Affiant Name string[] affiantNameParts = new string[] { entity.caffiant_title, entity.caffiant_first_name, entity.caffiant_last_name}; this.Affiant = Utility.FormatName(affiantNameParts); // Extra code removed }Here is the code where I am putting it on the page
protected void Page_Load(object sender, EventArgs e) { this.oArrest = (Arrest)RegisterBizObj(new Arrest()); // Lots of code removed if (!IsPostBack) { // Verify we have a Case Record if (this.oCase.Entity.HasValues) { this.DisplayCurrentArrest(arrestID); } } } private void DisplayCurrentArrest(Guid arrestID) { // Lots of code removed // Call the display of Affiant Control // The entity column is set as nullable, thus the extra coding here this.DisplayAffiantControl(this.oArrest.Entity.laffiant_is_civilian == true ? true : false); } protected void DisplayAffiantControl(bool isCivilian) { if (isCivilian) { ctrlCivilianAffiant civilAffiant = (ctrlCivilianAffiant)Page.LoadControl("~/UserControls/ctrlCivilianAffiant.ascx"); civilAffiant.SetupAffiant(this.oArrest.Entity); this.holdAffiant.Controls.Add(civilAffiant); } // Other options all removed }