|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
asp:Menu control does not work well in all browsersEvents Calendar If I click it I get a dropdown list of other menu items. Just like in Windows. But in some browsers the menuitem looks like: Events Calendar Expand Events Calendar If I click it I get: Events Calendar Events Locations ^Up One Level Pretty ugly, I think. Anything I can do about that? I'm using the asp:Menu control. Thanks "AAaron123" <aaaron***@roadrunner.com> wrote in news:ex3slq16JHA.1716 @TK2MSFTNGP03.phx.gbl:Show quoteHide quote > I IE a menu item looks like: I would personally consider using the CSS Friendly adapters and writing CSS > Events Calendar > > If I click it I get a dropdown list of other menu items. > Just like in Windows. > > But in some browsers the menuitem looks like: > Events Calendar Expand Events Calendar > > If I click it I get: > > Events Calendar Events Locations ^Up One Level > > Pretty ugly, I think. > > Anything I can do about that? > > I'm using the asp:Menu control. to configure the menu rather than have the menu control output the ugly tables. This means you are "on your own", but there are plenty of menu scripts out there you can use and it is fairly easy to find CSS that will work for you. -- Show quoteHide quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ****************************************** | Think outside the box! | ****************************************** "AAaron123" <aaaron***@roadrunner.com> wrote in message In addition to Gregory's (correct, IMO) suggestion that you use the CSS news:ex3slq16JHA.1716@TK2MSFTNGP03.phx.gbl... > Anything I can do about that? Friendly Adaptors version of the menu control (Google it...), you can use the technique described here: http://www.velocityreviews.com/forums/t386549-mac-and-aspnet-20.html to make the asp:Menu webcontrol display properly in Safari / Chrome etc, and you can use the technique described here: http://weblogs.asp.net/bleroy/archive/2009/03/23/asp-menu-fix-for-ie8-problem-available.aspx to make it display properly in IE8.
Show quote
Hide quote
"Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message I created a PageEx class inheriting from System.Web.UI.Page and insertednews:%23vfPd$16JHA.5780@TK2MSFTNGP04.phx.gbl... > "AAaron123" <aaaron***@roadrunner.com> wrote in message > news:ex3slq16JHA.1716@TK2MSFTNGP03.phx.gbl... > >> Anything I can do about that? > > In addition to Gregory's (correct, IMO) suggestion that you use the CSS > Friendly Adaptors version of the menu control (Google it...), you can use > the technique described here: > http://www.velocityreviews.com/forums/t386549-mac-and-aspnet-20.html to > make the asp:Menu webcontrol display properly in Safari / Chrome etc, and > you can use the technique described here: Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit If (Request.Browser.Browser.Contains("Safari")) Then Me.ClientTarget = "uplevel" End If End Sub And that fixed Safari. Is that need because asp.net has the wrong capability for Safari? Also, I searched the internet and only found references to Safari. Do you know what to check for as far as other browsers that need "uplevel"? I mean is FireFox and Chrome the strings that I should use in my "if" ststement? Are there others? I expected to find such a list but did not. Thank a lot. This was an easy fix. Now I'll read more about Friendly Adaptors. Show quoteHide quote > http://weblogs.asp.net/bleroy/archive/2009/03/23/asp-menu-fix-for-ie8-problem-available.aspx > to make it display properly in IE8. > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net "AAaron123" <aaaron***@roadrunner.com> wrote in message Yes - more specifically, the browscap definitions - Google it...news:eCMSWm76JHA.5756@TK2MSFTNGP02.phx.gbl... > And that fixed Safari. Is that need because asp.net has the wrong > capability for Safari? > I mean is FireFox and Chrome the strings that I should use in my "if" FireFox should be fine - not sure about Chrome...> ststement? > Are there others? Probably...> Now I'll read more about Friendly Adaptors. That will make all the "uplevel" problems disappear...> > FYI Chrome reports: AppleMAC-Safari>> I mean is FireFox and Chrome the strings that I should use in my "if" >> statement? > > FireFox should be fine - not sure about Chrome... > like Safari does. Before I make the suggested changes I'd like to clear up something else that
just occurred. Unless you think those changes will fix this too. After some debugging the following is true. In Sub Page_PreRender I do: Response.Write("<script type='text/javascript'>") Response.Write("</script>") The source in the browsers looks like: <script type='text/javascript'>var htmlStyle = document.getElementsByTagName('html')[0].style;htmlStyle.scrollbarBaseColor = 'black';</script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> ... When I removed that code from Page_PreRender my asp:Menu's drop-downs became white rectangles instead of a list of menu items. So I guessed that maybe if the DOCTYPE is not the first line it is ignored and removing the script line made it effective. Does that sound correct?? So I removed the DOCTYPE line from my code and the drop-down menu list looks OK (with or without the script line) I guess the browser defaults to something different if there is no DOCTYPE. What is the that default? I'd be surprised if you ran across this before but do you have any idea what might be happening? Thanks "AAaron123" <aaaron***@roadrunner.com> wrote in message Please don't use Response.Write to inject HTML or JavaScript into ASP.NET news:udpzi$56JHA.4404@TK2MSFTNGP04.phx.gbl... > Response.Write("<script type='text/javascript'>") > Response.Write("</script>") pages. ASP.NET is object-oriented, not linear like ASP Classic, so you have much less control over where the JavaScript ends up in the final markup. The ClientScript classes are designed specifically for this: http://www.google.co.uk/search?aq=f&sourceid=chrome&ie=UTF-8&q="ASP.NET"+ClientScript Since I posted I've changed to
Page.ClientScript.IsClientScriptBlockRegistered but this problem is with the DOCTYPE ot asp:Menu The script line simply masked that problem. Thanks Show quoteHide quote "Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message news:eQwqZI66JHA.1716@TK2MSFTNGP03.phx.gbl... > "AAaron123" <aaaron***@roadrunner.com> wrote in message > news:udpzi$56JHA.4404@TK2MSFTNGP04.phx.gbl... > >> Response.Write("<script type='text/javascript'>") >> Response.Write("</script>") > > Please don't use Response.Write to inject HTML or JavaScript into ASP.NET > pages. ASP.NET is object-oriented, not linear like ASP Classic, so you > have much less control over where the JavaScript ends up in the final > markup. > > The ClientScript classes are designed specifically for this: > http://www.google.co.uk/search?aq=f&sourceid=chrome&ie=UTF-8&q="ASP.NET"+ClientScript > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net
Other interesting topics
Hide IE's header and footer when printing
"customErrors" in "web.config" Error 1309 / WebResource.axd Multipule Postbacks Most Flexible UI Architecture? Address bar Milenko Kindl attacks US in speech in Italy2 label size style not working query registry from aspx page Problem with two instances of a custom class |
|||||||||||||||||||||||