|
Hi There If like me you love to use CSS instead of HTML tables for the layout design of your pages then you no doubt have at least tried the CSS Adapter for asp.net 2.0 controls, if not take a look here. Scott Gu has a great blog on it here, which discusses the new release, how to install etc. In a previous post (link to it on the same post) he talks about how easy it is to write your own adapter. It comes with a nice tutorial and sample application, I have to say that its not as straight forward as I originally thought but once you get your head round the extensive (to me!) CSS classes you'll love it....not to mention the huge reduction in page size (in my case anyway ;-D). So anyway..the error!!! IE6 doesn't support the :hover tag in CSS on anything other than 'a' tag, so the adapter uses JavaScript to perform the action.....it runs a function that attaches to the onmouseover and onmouseout event, the function is run like this window.onload = SetHover_AspNetMenu; ...well if in your own page you override the onload event like this.. this.onload = function() { //some code in here } then the SetHover.. function will not be called. First of all I simple did a check for < IE7 and ran the code myself from my own onload override. Then after talking with Russ on the asp.net forums he suggested coming up with a simple way to do this for everyone. So I added this to bottom of the MenuAdapter.js file function SetupMenuForIE6() { if (isPreIE7) { SetHover__AspNetMenu(); } } Then went into the MenuAdapter file where all the other scripts are called in the method RegisterScripts() and added this Page.ClientScript.RegisterStartupScript(GetType(), "Menu-IE6-JS", "<script type='text/javascript'>SetupMenuForIE6();</script>"); Hope this helps someone has had the same problem I have. Steve
|