Tuesday, December 9, 2008

Internet Explorer cannot open the Internet site, Operation aborted. Asp.net menu control.

This error is caused by rendered javascript code of asp.net control trying to change an element when the page is not completely loaded.
It happens when moving the mouse pointer to the menu items and the page is loading.

A solution to work around this issue is to surround the menu control with <div> tag.
Set its attribute visibility:hidden. On page_load, set it back to visible.
The purpose is to hide the menu control when the page is loading and show it after loading page is finished.

See the sample code bellow:


......
<script type="text/javascript">
function showMenu() {
document.getElementById("menuHeader").style.visibility='visible';
}

</script>
......

<body onload="showMenu()" >
<div id="menuHeader" style="visibility:hidden;">
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" DataSourceID="SiteMapDataSource1"/>
</body>

......


Trust me it works great with litle effort.
Dane