Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Enabling Smart Navigation and using JavaScript Code does not work

Posted on 2003-11-30
9
459 Views
Last Modified: 2008-02-26
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.
Here is a sample Javascript code which I'm using

      Response.Write("<script language='javascript'>")
                Response.Write("window.open('POREP01.aspx')")
                Response.Write("</script")        
      Response.Write(">")

The error message which I'm getting is
'htmlfile:Invalid pointer'

A page http://localhost/aspnet_client/system_web/1_0_3705_352/SmartNav.js is opened in debug mode in Visual studio.Net, and it breaks at the line

            hdm.appendChild(k);
Is this a bug from Microsoft,
Pls help,
regards,
Priya
0
Comment
Question by:Priya25
  • 4
  • 4
9 Comments
 
LVL 12

Accepted Solution

by:
roverm earned 250 total points
ID: 9849632
It seems that the adding of the javascript is causing the error.
Try to add it via the Register function and use a function:

In your page_load event:

Dim strScript As String = "<script language='javascript'>" & vbCrLf
strScript += " function window.onload() {" & vbCrLf
strScript += "    window.open('POREP01.aspx'); }" & vbCrLf
strScript += "</script>" & vbCrLf

Me.RegisterClientScriptBlock("yournameofthescript", strScript)

D'Mzz!
RoverM
0
 

Author Comment

by:Priya25
ID: 9865783
Your solution works fine..thanx very much..

But now the new window is being displayed at the back of the main web page...that is it is minimised..we have to maximise it to see it...my user may not notice that the new window has been opened...
0
 
LVL 12

Expert Comment

by:roverm
ID: 9865911
Hi priya, thanks for the points but why did you close it with a B while with a little more information it could have been an A?

The solution is to add some 'features' to the window.open:

  var sfeat='left=50,top=50,height=450,width=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes';
  window.open('POREP01.aspx', '_blank', sfeat);

D'Mzz!
RoverM
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Author Comment

by:Priya25
ID: 9865981
sorry for not giving u an A..also u deserve it..its just because the solution was not 100 % complete...i mean the
window was opening at the back...I'll try what u just send...

But rest assured this mistake will not be repeated.

Thanx again and Regards,
Priya
0
 
LVL 12

Expert Comment

by:roverm
ID: 9866067
>>just because the solution was not 100 % complete

Not entirly true, I copied your open statement from the question. I could not know that you wanted to do something else with it.
So, the solution *was* complete, you just needed something more than you originally asked for.

But if you agree that this should have been an A-grade (not just for me, but also for the value of this PAQ) then I can ask a moderator to correct it. Just let me know.

I assume that adding the features helped?

D'Mzz!
RoverM
0
 

Author Comment

by:Priya25
ID: 9872186
Hello RoverM,
I didn't know that it will so much difference to someone to get a B instead of an A..In fact I even dont know
how does EE handles the marking scheme..I must say that I'm quite new to EE.

Anyway as u mentioned, you can ask a moderator to correct it, its fine for me.
But ading the features did not work..I've already tried it..the window still opens at the back..

Regards and sorry,
Priya
0
 

Author Comment

by:Priya25
ID: 9872400
I have been able to make the pop screen appear on top by adding the following in my HTML

<body onLoad="window.focus()">

this works fine...
You have been of great help to me,
Thanx
0
 
LVL 12

Expert Comment

by:roverm
ID: 9872860
Priya25,
Thanks, and it's no problem! No need to apologize! ;-)

D'Mzz!
RoverM
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question