473,395 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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(ByVal Message As String)

System.Web.HttpContext.Current.Response.Write("<SC RIPT
LANGUAGE=""JavaScript"">" & vbCrLf)

System.Web.HttpContext.Current.Response.Write("ale rt(""" & Message & """)" &
vbCrLf)

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

End Sub
Does anyone know why this is?

- Castro
Nov 18 '05 #1
3 2580
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='javascript'>alert('message');</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
"RegisterStartupScript " to register the client script, the
"RegisterStartupScript " 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.Current.Handler
and call the page's RegisterStartupScript to write out the messagebox script

For example:
Public Sub ASPNET_MsgBox(ByVal Message As String)

Dim script As String = "<script
language='javascript'>alert('{0}');</script>"
Dim page As System.Web.UI.Page = HttpContext.Current.Handler

page.RegisterStartupScript("showmb", String.Format(script, 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='javascript'>alert('message');</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
"RegisterStartupScript " to register the client script, the
"RegisterStartupScript " 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.Current.Handler
and call the page's RegisterStartupScript to write out the messagebox script

For example:
Public Sub ASPNET_MsgBox(ByVal Message As String)

Dim script As String = "<script
language='javascript'>alert('{0}');</script>"
Dim page As System.Web.UI.Page = HttpContext.Current.Handler

page.RegisterStartupScript("showmb", String.Format(script, 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
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...
4
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...
1
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....
1
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...
2
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....
3
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...
1
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...
0
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...
8
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.