473,545 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript alert - Smart Navigation problem

With SmartNavigation =true a call to display a simple javascript alert
returns in IE showing an "Invalid Pointer" error.

Apparently when SmartNavigation is disabled then the alert works correctly.

When I remove the <doctype> tag the alert works again.

I'd prefer to keep a doctype tag in my page if at all possible.

Doc type:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Javascript function in code behind:
Public Sub ASPNET_MsgBox(B yVal Message As String)

System.Web.Http Context.Current .Response.Write ("<SCRIPT
LANGUAGE=""Java Script"">" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("alert(""" & Message & """)" &
vbCrLf)

System.Web.Http Context.Current .Response.Write ("</SCRIPT>")

End Sub
Does anyone know why this is?

- Castro
Nov 18 '05 #1
3 2604
Hi Castro,

From your description, you found that when the asp.net's smart navigation
is turn on, if we use response.
write to write a clienscript block to client such as
<script language='javas cript'>alert('m essage');</script>, it will failed
with "invalid pointer"

I've also tested on my side and did found this problem. I think this
problem is likely due to the Response.Write' s output is conflicting with
the smartnavigation 's output
script. The response.Write will always write out all the content before
the page's render out content. I recommend that you try using
"RegisterStartu pScript " to register the client script, the
"RegisterStartu pScript " will ensure that the script block is rendered
within the Page's body and in the proper location. You can retireve the
current Request 's Page handler via
HttpContext.Cur rent.Handler
and call the page's RegisterStartup Script to write out the messagebox script

For example:
Public Sub ASPNET_MsgBox(B yVal Message As String)

Dim script As String = "<script
language='javas cript'>alert('{ 0}');</script>"
Dim page As System.Web.UI.P age = HttpContext.Cur rent.Handler

page.RegisterSt artupScript("sh owmb", String.Format(s cript, Message))

End Sub

Please have a try to see whether this helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2
Hi Castro,

From your description, you found that when the asp.net's smart navigation
is turn on, if we use response.
write to write a clienscript block to client such as
<script language='javas cript'>alert('m essage');</script>, it will failed
with "invalid pointer"

I've also tested on my side and did found this problem. I think this
problem is likely due to the Response.Write' s output is conflicting with
the smartnavigation 's output
script. The response.Write will always write out all the content before
the page's render out content. I recommend that you try using
"RegisterStartu pScript " to register the client script, the
"RegisterStartu pScript " will ensure that the script block is rendered
within the Page's body and in the proper location. You can retireve the
current Request 's Page handler via
HttpContext.Cur rent.Handler
and call the page's RegisterStartup Script to write out the messagebox script

For example:
Public Sub ASPNET_MsgBox(B yVal Message As String)

Dim script As String = "<script
language='javas cript'>alert('{ 0}');</script>"
Dim page As System.Web.UI.P age = HttpContext.Cur rent.Handler

page.RegisterSt artupScript("sh owmb", String.Format(s cript, Message))

End Sub

Please have a try to see whether this helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3
Hi Castro,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
7059
by: Gowhera Hussain | last post by:
Use This for Learning Only .... Do Not Try To Act Smart HACKING WITH JAVASCRIPT Dr_aMado Sun, 11 Apr 2004 16:40:13 UTC This tutorial is an overview of how javascript can be used to bypass simple/advanced html forms and how it can be used to override cookie/session
4
8859
by: PiedmontBiz | last post by:
Greetings I have written an online survey with 110 questions. I use javascript to cycle thru all the questions which are displayed in an iframe. I keep track of the question number using a "global" variable. When testing it, everything works fine until I hit the back button. The iframe goes to the previous question, but of course, the...
1
1458
by: Priya | last post by:
I have enabled smart navigation for my ASP.Net web application. It works fine except for some of my pages where I'm using some Javascript code to open a page in a new window on a button click. Here is a sample Javascript code which I'm using Response.Write("<script language='javascript'>") Response.Write("window.open('POREP01.aspx')")...
1
1411
by: Ying Huang-Isella | last post by:
I have a Javascript menu bar on top of each of my aspx pages. The menu bar would not display when I turn on SmartNavigation. I did some search on this newsgroup and found the answer to my problem in this post http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=e6EidZJoBHA.2244%40tkmsftngp05 Apparently Smart Navigation does not...
2
369
by: Marc Castrechini | last post by:
With SmartNavigation=true a call to display a simple javascript alert returns in IE showing an "Invalid Pointer" error. Apparently when SmartNavigation is disabled then the alert works correctly. When I remove the <doctype> tag the alert works again. I'd prefer to keep a doctype tag in my page if at all possible. Doc type:
3
2394
by: Lee Forst | last post by:
I have looked through tons of posts and I have not found a clear cut answer to my problem. Here is the problem. On my localhost, I have a ASP.NET application that has Smart Navigation turned on and it works fine running the application on my browser. However, if I copy the application to our build server, and run the application from...
1
1316
by: thomson | last post by:
Hi all, i have enabled Smart Navigation in the Page attribute, My Webform has several Webform controls, all applied with style sheets from an external file. Problem --------- When a postback event is occured due to a dropdownlist, all my styles applied to the entire form is dissappeared, this occured only after enabling the Smart...
0
1200
by: keeper | last post by:
Recently a new windows update for internet explorer was released which seems to have broken stylesheets with smart navigation. The first request for the page works fine, but any subsequent postbacks when smart navigation is applied results in internet explorer not applying the style sheet. Has anyone else had this problem and found a...
8
2599
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
54
11912
by: Boris | last post by:
I had a 3 hours meeting today with some fellow programmers that are partly not convinced about using smart pointers in C++. Their main concern is a possible performance impact. I've been explaining the advantages of smart pointers endlessly (which are currently used in all our C++ software; we use the Boost smart pointers) as I'm seriously...
0
7496
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7428
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7452
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6014
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5354
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3485
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1039
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.