Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 13th, 2010, 01:48 PM
Authorized User
 
Join Date: Dec 2009
Posts: 63
Thanks: 18
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Wilfredo Rosado
Default Menu's

Does anyone know why the menus work fine in IE but not Safari or Google Chrome? You can go to my website to see what I mean. www.home-remake.com. It would be nice to have it work properly on all browsers.

I saw in another help request there is a fix for this problem. I'm not sure how to exactly apply this fix in the base page. I have included your fix in my Basepage shown below, but I get an error on the request.ServerVariables: "Value of type 'System.Collections.Specialized.NameValueCollectio n' cannot be converted to boolean."


Code:
Imports Microsoft.VisualBasic

Public Class BasePage
  Inherits System.Web.UI.Page

  Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender

    If Me.Title = "" Then
      Throw New Exception("Page title must be defined.")
    End If
  End Sub

  private sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs e) Handles Me.PreInit

    if Request.ServerVariables["http_user_agent"].IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1
       Page.ClientTarget = "uplevel";
    End If
  End Sub

End Class
Any ideas anyone?
Fred

Last edited by Wilfredo Rosado; August 13th, 2010 at 06:41 PM.. Reason: found
 
Old August 13th, 2010, 07:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're mixing up C# and VB. Try something like this:

If Request.ServerVariables("http_user_agent").IndexOf ("Safari", StringComparison.CurrentCultureIgnoreCase) > -1 Then
Page.ClientTarget = "uplevel"
End If

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Wilfredo Rosado (August 13th, 2010)
 
Old August 13th, 2010, 07:24 PM
Authorized User
 
Join Date: Dec 2009
Posts: 63
Thanks: 18
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Wilfredo Rosado
Default

Hi Imar,

Thanks for that correction. I now do not get any errors, however when I run the website in Chrome or Safari the menus still act the same way. Interestingly however, when I click on the login button it rewrites the screen with the login page, which has the same menu and now the menu works ok. If however I closed the browser and reopen a new session in Chrome or Safari, it reverts to not working until I click the Login button again...Not sure what is going on there, but it would be nice not to have to click a button to get the menu to work properly.

Any ideas?

Fred

Fred
 
Old August 13th, 2010, 11:31 PM
Authorized User
 
Join Date: Dec 2009
Posts: 63
Thanks: 18
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Wilfredo Rosado
Default

Hi Imar,

I figured out why the menus didn't work unless I clicked the Login button. My website is a relatively small website and when you first get in it is through default.aspx. From that page you can get to the other pages via the menu.

However the menu did not work in Chrome and Safari so there was no way to get to the other pages except throught the Login button. That left only two pages available the default page and the Login page. One worked the other didn't, so I therefore looked at the Default.aspx.vb code and noticed that it did not inherit the basepage, it was still inheriting from "System.Web.UI.Page". Some how that slipped by me. Anyway, I changed it to inherit from BasePage and now it works fine.

Thanks for helping with the VB vs C# code syntax problem.

Fred





Similar Threads
Thread Thread Starter Forum Replies Last Post
MDI & MDI Child Forms Menu's in VB2005 yulyos Visual Studio 2005 0 September 7th, 2007 09:49 AM
Menu's DynamicEnableDefaultPopOutImage?? rit01 ASP.NET 2.0 Basics 5 April 19th, 2006 04:01 PM
Pop up Menu's derek Dreamweaver (all versions) 7 November 4th, 2004 07:13 PM
Pop up menu's in templates derek Dreamweaver (all versions) 2 May 8th, 2004 01:33 PM
Pop up Menu's derek Dreamweaver (all versions) 2 January 14th, 2004 07:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.