Can I do something like:
where in the case UpdateRemoteDB() fails, then DisplayMessageThatUpdateRemoteDBFailed() would ideally trigger a message that the remote db update failed and that the user should contact the admin.
However, i am trying to make it as unobtrusive as possible - i.e. i would rather not redirect the user to whole different custom error page: if possible I'd prefer to return an error message to the screen on some sort of asp.net control - ie: to perhaps trigger visibility of a hidden label, (or maybe a customvalidator control????) in a spot on the screen close to the dropdown.
So is it possible to trap the exception as it "bubbles up" through the stack and use it within your app on an asp.net control?
Code:
Protected Sub myDropdown_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Try
UpdateRemoteDB()
SendAnAlertMailThatItWorked()
Catch ex As Exception
DisplayMessageThatUpdateRemoteDBFailed()
SendEmailToAdminWithErrorDetail()
End Try
End Sub
where in the case UpdateRemoteDB() fails, then DisplayMessageThatUpdateRemoteDBFailed() would ideally trigger a message that the remote db update failed and that the user should contact the admin.
However, i am trying to make it as unobtrusive as possible - i.e. i would rather not redirect the user to whole different custom error page: if possible I'd prefer to return an error message to the screen on some sort of asp.net control - ie: to perhaps trigger visibility of a hidden label, (or maybe a customvalidator control????) in a spot on the screen close to the dropdown.
So is it possible to trap the exception as it "bubbles up" through the stack and use it within your app on an asp.net control?