Label does not display text or update text when a specific method is called

Immiltcatty

New Member
I am working with a Visual WebPart (c#) which consists of an UpdatePanel which wraps the contents of the web form. On this form, within the UpdatePanel, I have an asp.net label which has its text property set based on the outcome of the submit. It's set to visible after execution, and its forecolor is changed as well depending on error or success. This works perfectly (text updates/becomes visible) until I decide to call a specific method when the submit button is pressed. When this method is called, the text property is not updating and the label is not displaying.I have debugged this process several times and each time I step through the process and see the correct message, see it get applied to the label's text property, and complete but the page is not updated. I can reproduce the working functionality by commenting out the method call. No errors are being thrown. The program appears to execute properly while debugging.submit button code excerpt:\[code\]try { CreateElementOnDestinationWebs(this.ddlSupportedElements.SelectedValue.ToString(), elementName, ref messages); msg = String.Format("<br />We have successfully created your {0}. Please review the following outcomes: <br /><ul>", this.ddlSupportedElements.SelectedItem.Text); foreach (string m in messages) { msg += String.Format("<li>{0}</li>", m); } msg += "</ul>"; labelMessages.Text = msg; labelMessages.Visible = true; labelMessages.ForeColor = System.Drawing.Color.ForestGreen; } catch (Exception ex) { msg = String.Format("<br />An unexpected error occurred while creating the item: {0}", ex.ToString()); labelMessages.Text = msg; labelMessages.Visible = true; labelMessages.ForeColor = System.Drawing.Color.Maroon; }\[/code\]CreateElementOnDestinationWebs source:\[code\]try { Guid listId = web.Lists.Add(name, "Student work can be submitted here.", SPListTemplateType.DocumentLibrary); web.Update(); SPList newList = web.Lists[listId]; newList.OnQuickLaunch = this.checkDropBoxShowOnQuickLaunch.Checked; newList.EnableModeration = true; newList.Update(); GrantStudentGroupsContributeRights(web, ref newList, ref msgs); try { DetectAddColumnsToDropbox(web, ref newList, ref msgs); } catch (Exception) { msgs.Add("There was an unexpected error while attempting to add the site columns to the library."); } msgs.Add(String.Format("Your item: {0}, has been successfully created on site: <a href='http://stackoverflow.com/questions/15484071/{1}' target='_blank'>{2}</a>", name, web.Url, web.Title)); } catch (Exception) { msgs.Add(String.Format("An error occurred while creating the document library for student work on site: <a href='http://stackoverflow.com/questions/15484071/{0}' target='_blank'>{1}</a>", web.Url, web.Title)); }\[/code\]If the try block containing "DetectAddColumnsToDropbox" is commented out the label (labelMessages) appears correctly. If not, the label does not appear/update. The method in question does not update any control or item on the form.
 
Back
Top