I am working on a simple web form that submits information to a 2012 sql server database. No duplicate entries are allowed, so I have added a try-catch to the code behind to display the error message. But I have a label that is set to appear when the page posts back stating that the record was successfully created. I need this message to be suppressed when there is an error. Any help would be greatly appreciated.
The following is the code I need suppressed if there's an error:
protected void Page_Load(object sender, EventArgs e)
if (Page.IsPostBack == true)
new_doc_rvw_submitted_lbl.Text = ("Your new document review has been created.");
The following is my try-catch:
lblMessage.Text = ex.Message;
How can I suppress 'new_doc_rvw_submitted_lbl
' if there's an error?
I am currently using Visual Studio 2013