473,327 Members | 1,919 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,327 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 2572
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.