?
Solved

Classic ASP and ASP.NET - Toggle back and forth

Posted on 2007-09-28
5
Medium Priority
?
388 Views
Last Modified: 2008-03-06
Experts,
I am going from a Classic asp page to a aspx page in 2.0.   The aspx page is opened in a new window.  If I Alt-Tab, I can toggle back and forth.  Is there a way to simulate this in the aspx page  (and perhaps also in the classic asp page.
Thanks
0
Comment
Question by:Howard Katz
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 19981159
Your request isn't very clear.  Do you mean that you want to press a button on the .ASPX that switches you to the .ASP, and vice versa?
0
 

Author Comment

by:Howard Katz
ID: 19981223
Yes.  I have a jpg on the aspx page that is a thumbnail of the larger graphic on the asp page.  I would like to be able to click on it to go to the asp page....and vice versa.
0
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 2000 total points
ID: 19981842
This can be done, but it's not very straightforward; I'll use Javascript (which both ASP and ASPX can use).  

There is no "switch windows" function.  To switch to an existing window, that window MUST have been opened by the window.open() function with a call of this form

window.open(url, name);

(NOT, repeat NOT, by normal navigation) so that a window name could be assigned.  The switch takes place when you open the window with this form:

window.open(url, name);

and yes, it's the same form - you switch to an existing window by opening it with the same url and name.

Thus, the page with the thumbnails can't be created from normal navigation, but must be opened with window.open().

Here's an example app that I used to explore the problem, one .HTM, one .ASP, and one .ASPX:

index.htm (the entry file into the application):

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>TestIMGclicktasp</TITLE>
</HEAD>
<BODY>

<P><%@ Language=VBScript %>
<META content="Microsoft Visual Studio 6.0" name=GENERATOR></P>
<P>&nbsp;</P>
<P>
<SCRIPT language=javascript type=text/javascript>
// <!--
      var w = window.open("TestIMGclick.aspx","TestIMGclickaspx");
      if (!w.closed)
      {
            w.navigate("TestIMGclick.aspx");
            w.focus();
      }
      
      window.close();
// -->
</SCRIPT>
</P>

</BODY>
</HTML>

TestIMGclickt.asp:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P>&nbsp;</P>
<script type="text/javascript" language="javascript">
// <!--
      function clicked() {
            var w = window.open("TestIMGclick.aspx","TestIMGclickaspx");
            if (!w.closed)
            {
                  w.navigate("TestIMGclick.aspx");
                  w.focus();
            }
      }
// -->
</script>
<IMG onclick="clicked()" src="http://sbodev2.pfpc.net/TestIMGClick/images/az_elm.jpg">ELM</IMG>

</BODY>
</HTML>

TestIMGclick.aspx (be sure to build this in VS.NET first, otherwise you'll get a runtime error):

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestIMGClick.aspx.vb" Inherits="TestIMGClick.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>TestIMGclickaspx</title>
            <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
      </HEAD>
      <body MS_POSITIONING="GridLayout">
            <script type="text/javascript" language="javascript">
            // <!--
                  function clicked() {
                        var w = window.open("TestIMGclickt.asp","TestIMGclicktasp");
                        if (!w.closed)
                        {
                              w.navigate("TestIMGclickt.asp");
                              w.focus();
                        }
                  }
            // -->
            </script>
            <form id="Form1" method="post" runat="server">
                  <IMG onclick="clicked()" src="http://sbodev2.pfpc.net/TestIMGClick/images/NoAlert.JPG"/>
            </form>
      </body>
</HTML>


Set up a ASP.NET Application project, then add these three files and make index.htm the startup file, then watch it go.  Once you do, you'll get the idea of how to integrate this into your application.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20699168
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

580 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