I’ve got an ASP.NET application, which calls this code at some point, to display an error message:
ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Incorrect login details.')", true);
For some reason or other, when this alert box is displayed, my webpage’s layout is changed and some elements are not in their correct places.
Is there any way that this may be avoided?
When the response is written, it’s immediately starts executing it and that’s why probably your HTML is messed.
Try to
alertafter the page is loaded.You can achieve this easily using jQuery.