Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
  #1 (permalink)  
Old July 4th, 2008, 07:06 AM
Authorized User
 
Join Date: Dec 2006
Location: Accra, , Ghana.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error at button onClick

I am trying to navigate to another page with the help of a button.
I used onClick="window.location='http://localhost/adbintranet/index/GoldDriveCustInfo.aspx'"

When i compile i get an error that reads:
Compiler Error Message: BC30456: 'window' is not a member of 'ASP.GoldDrive_aspx'.

I have tried different onClick methods but still get the BC30456.

Please help.


  #2 (permalink)  
Old July 6th, 2008, 08:22 AM
Authorized User
Points: 198, Level: 3
Points: 198, Level: 3 Points: 198, Level: 3 Points: 198, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: singapore, singapore, Singapore.
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts
Default

change on click to onClientClick and put javascript: before window.location
some thing like follows

 onClientClick="Javascript:window.location='http://localhost/adbintranet/index/GoldDriveCustInfo.aspx'"

Note: dont give the absolute path give the relative path always when it goes to production the local host has to be changed if you are giving absolute path

Pon Saravanan
http://www.vbknowledgebase.com
  #3 (permalink)  
Old July 7th, 2008, 06:22 AM
Authorized User
 
Join Date: Dec 2006
Location: Accra, , Ghana.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your assistance. This time around i do not get the error but the page does not route to the next page. Page remains unchanged.

Asters


Quote:
quote:Originally posted by pons_saravanan
 change on click to onClientClick and put javascript: before window.location
some thing like follows

onClientClick="Javascript:window.location='http://localhost/adbintranet/index/GoldDriveCustInfo.aspx'"

Note: dont give the absolute path give the relative path always when it goes to production the local host has to be changed if you are giving absolute path

Pon Saravanan
http://www.vbknowledgebase.com
  #4 (permalink)  
Old July 8th, 2008, 12:59 AM
Authorized User
Points: 198, Level: 3
Points: 198, Level: 3 Points: 198, Level: 3 Points: 198, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: singapore, singapore, Singapore.
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Use window.location.href to navigate so it should be something like

onClientClick="Javascript:window.location.href='ht tp://localhost/adbintranet/index/GoldDriveCustInfo.aspx'"


Pon Saravanan
http://www.vbknowledgebase.com
  #5 (permalink)  
Old July 8th, 2008, 09:48 AM
Authorized User
 
Join Date: Dec 2006
Location: Accra, , Ghana.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help.
I guess there is somthing wrong somewhere.
It still does not work.
However, if i replace the onClientClick with onMouseOver the page navigaes to the GoldDriveCustInfo.aspx successfully.

Any additional help for the onClientClick or onClick to work?

Thanks
asters

Quote:
quote:Originally posted by pons_saravanan
 Use window.location.href to navigate so it should be something like

onClientClick="Javascript:window.location.href='ht tp://localhost/adbintranet/index/GoldDriveCustInfo.aspx'"


Pon Saravanan
http://www.vbknowledgebase.com
  #6 (permalink)  
Old July 23rd, 2008, 09:35 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

didn't work for me until I used a return false to stop it from submitting the page.

onClientClick="javascript:window.location.href='pa ge.aspx'; return false;"


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button OnClick problem john6630 ASP.NET 2.0 Basics 2 September 21st, 2007 05:44 PM
Image button onclick msbsam ASP.NET 2.0 Basics 0 December 30th, 2006 04:47 AM
Change onclick of a button me_zeta HTML Code Clinic 1 November 20th, 2006 10:34 AM
Button onClick Apocolypse2005 Javascript 1 November 25th, 2005 09:37 AM





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