Solved

Enabling Smart Navigation and using JavaScript Code does not work

Posted on 2003-11-30
9
462 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
[X]
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
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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