Currently, I am dealing with an ASPx/C# page where clicking the Save button triggers a post back to the server. If the data in the controls already exists in the checked data stores, it is supposed to trigger an alert message. Previously, the developer utilized:
<asp:Literal ID="litError" runat="server" />
The code behind then sets:
litError.Text = "<script type='javascript'>alert('An error occured while processing this request. If the error persists, please contact the help desk.');</script>";
Despite the debug reporting successful processing, the JavaScript alert is not functioning as expected. After days of searching online for a solution, including here, I have tried various approaches to resolve this issue.
I suspect that the script may not be able to run on AJAX because it is not present during the Load stage of the life cycle. I would appreciate some confirmation on this matter.
The script is within the btnSave_OnClick method. Unfortunately, due to constraints, I cannot provide more code. However, the script should activate if an item exists in either the application database or if the user is already present in our Active Directory system.