Despite finding a similar question, the provided answer did not resolve my issue.
This is how my application typically appears:
However, after triggering a JavaScript alert, the width of menu items becomes distorted and an additional part is added to the purple bar on the left:
Below is the code snippet I am using to display an alert:
private void Alert(string msg)
{
Response.Write("<script language = 'javascript'>window.alert('" + msg + "')</script>");
}
Has anyone encountered this problem before? I experienced a similar issue even with the default asp.NET design. How can I resolve this? Just to note, I am currently using IE 7 and everything functions correctly on Firefox.
Update:
Managed to fix the issue with the purple bar by removing a margin. Still working on resolving the menu width problem.
Here is a snippet of my CSS:
#menu
{
position: absolute;
left: 78%;
top: 108px;
width: 170px !important;
}
div.menu
{
padding: 4px 0px 4px 8px;
}
div.menu ul
{
list-style: none;
margin: 0px;
padding: 0px;
width: auto;
}
div.menu ul li a, div.menu ul li a:visited
{
background-color: #FFF; /*680840*/
border: 1px #4e667d solid;
height: 20px;
width: 140px;
color: #000; /*FFF*/
display: block;
line-height: 1.35em;
padding: 4px 20px;
text-decoration: none;
white-space: nowrap;
}
div.menu ul li a:hover
{
background-color: #680840;
color: #FFF;
text-decoration: none;
}
.selectedMenu
{
background-color: #680840;
color: #FFF;
text-decoration: none;
}
div.menu ul li a:active
{
background-color: #680840;
color: #cfdbe6;
text-decoration: none;
}
Update For @Sassyboy :
Front-End:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:HiddenField Value="" ID="errorMessageHidden" runat="server"/>
<script type="text/javascript">
var alertMsg = document.getElementById('errorMessageHidden');
if (alertMsg != null) alert(alertMsg);
</script>
In addition, in C# I have included the following:
errorMessageHidden.Value = "Failed to Select - Test";