Last post Jan 05, 2010 12:49 AM by Aamir Hasan
Jun 26, 2009 12:17 PM|cbspira|LINK
I've been searching for this several days - I'm hoping someone out there can help.
I'm using the css friendly menu adapter on a master page. It looks fine on IE7 and Firefox. My problem is with Chrome - it only renders properly the first time the page is loaded after launching the VWD dev server - as soon as I click on a menu item or
even just reload the page the menu looks like a poor rendition of the asp:menu control. I've even ascertained that something is different because the "view source" for the page is different - the first load it has the menu as expected, with ul and li - and
with subsequent loads it is rendered as a table.
As per my multiple searches, I've added the Request.Browser.Adapters.Clear() fix to the page load of the master page. This helped render the asp:menu control to begin with (before this the submenu items would display with the word "Expand" that then had
to be clicked)
I also tried using the ClientTarget="uplevel" fix to the pre-init of a single page (to test it out) - did not appear to make a difference here either.
I'm imagining that if I'm having this problem with Chrome then it's a problem with Safari as well, so I would like to get this issue resolved...
"css friendly adapter"
3.5 2008 friendly css adapters
Menu css friendly adapters W3C Validation Check
ASp .net MENU control adapters
Jun 29, 2009 12:37 AM|cbspira|LINK
Still have not found the reason for this. However, I did load the pages on my commercial host (as opposed to only testing with the VWD dev server) - and the menu is rendering properly (ie, as an unordered list with the appropriate CSS class applied) in Chrome
and FireFox (and IE).
This is making testing a bit cumbersome, but at lease I can go live with this...
If anyone does have any ideas as to why this happened please let me know - I'm afraid that maybe the dev server got corrupted somehow and now I don't know if I can trust other output...
Jul 20, 2009 06:12 PM|pfontyn|LINK
Did you ever find a solution to this problem? I seem to have managed to take it one step further than you - when I browse the website using chrome on the commercial web server, it messes up the menu for clients in other locations using different browsers.
I'm absoloutly stumped with this as it leads me to believe that chrome is somehow writing something to the server.
Jul 20, 2009 08:03 PM|pfontyn|LINK
It seems as though when the aspnet_wp (or WebDev.Webserver.exe, depending on config, probably) gets recycled, it re-sets the page so that images will load properly in supported browsers again.
This doesn't really clear anything up for me, but it adds a bit of information to the subject.
Jul 22, 2009 07:27 PM|pfontyn|LINK
Ok, I'm not 100% sure on this, but it looks as though this is the problem.
For whatever reason, when a link in the menu is clicked using chrome, it appears as though it generates extra scriptresource and webresource files - which IE then apparently uses. Basically it seems as though all browsers from that point on seem to lose
the stylesheet - which leads me to believe that it's not being rendered properly when the webresource files are compiled.
I don't know what chrome would be sending to the server that would cause this - I stripped out the css friendly code, bashed together a some styles for the standard menu control and everything seems to be working properly.
Jul 22, 2009 10:09 PM|cbspira|LINK
Sorry for not replying sooner - I've been off-line...
I never did figure it out - for some reason chrome does render it properly on the comercial host (IIS 7, if I'm not mistaken). IE6 does NOT render it at all - the whole menu control does not display (but that was reported to me by mthe customer - I do not
have a way to test it out currently, so I don't know what the generated html really looks like)
FWIW, if you can get it to work, there's a way to specify a skin to be used if the browser will not support the control adapter (or if you specify for it not to use the adapter). See here:
(although I personally have not gotten the skin to work too well, but that could very well be my lack of knowledge on how to integrate css styles in the skin)
But why does it seem to work for all other browsers that purport to be on a similar level of compliance? And why are we the only ones asking about this? :-)
Sep 20, 2009 02:11 PM|danielgindi|LINK
I had the same problem, and there's a simple fix, which I took from here:
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
to your Page_Init or Page_Load event (in master page if you want),
and this will fix all the problems: the CSS rendering problem, the "rendering only first time" problem, and the not rendering dynamic menus at all problem...
Sep 20, 2009 02:13 PM|danielgindi|LINK
BTW, if you want to be more accurate and prevent possible Adapter problems of other controls, you can add a code block inside the IF, to search for the specific asp:Menu adapter, and kill it.
Sep 21, 2009 01:05 AM|cbspira|LINK
Thanks for the reply, but if you look at my initial post you'll see that I already tried that method (and added it to the page load of the master page)
What has been working so far with the VWD server (but I have not fully tested it live on the comercial host, so I did not update this thread) is adding the following to the pre-init of the base page (which I guess would be the equivalent of adding it to
the pre-init of the master page if a base page is not used?)
If (Request.UserAgent.IndexOf("AppleWebKit") > 0) Or (Request.UserAgent.IndexOf("Unknown") > 0) Or (Request.UserAgent.IndexOf("Chrome") > 0) Then
Page.ClientTarget = "uplevel"
This was cobbled from assorted sources - unfortunately I do not remember where so I can not credit them appropriately...
Nov 27, 2009 03:15 AM|Tony1010|LINK
Did not work for me either...
Jan 05, 2010 12:47 AM|Aamir Hasan|LINK
protected void Page_PreInit(object sender, EventArgs e)
// This is necessary because Safari and Chrome browsers don't display the Menu control correctly.
// All webpages displaying an ASP.NET menu control must inherit this class.
if (Request.ServerVariables["http_user_agent"].IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1)
Page.ClientTarget = "uplevel";
visit my Blog Student Academic Blog
Mark as Answerif Helps you
Jan 05, 2010 12:49 AM|Aamir Hasan|LINK