On my Page_Load command for a page, I have a couple of tests that are performed before the screen is displayed with an alert box displaying if the user cannot access the screen.
If Not Page.IsPostBack Then
UpdatePanel1.ContentTemplateContainer.Controls.Add(ctl)
UpdatePanel1.Update
UpdatePanel2.ContentTemplateContainer.Controls.Add(ctl)
UpdatePanel2.Update
If ScreenAccessible = False
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "denied", "alert('Access Denied');", True)
End If : End If
I would assume that based on the order of the procedure above, the update panels should update first, and then the alert message will follow.
However, the alert message shows up first, with the update panels empty. When I click the OK button on the alert box, the update panels are correctly render.
How do I allow the JavaScript alert box to appears after the update panels have rendered?