Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 10th, 2005, 12:06 PM
Authorized User
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reload ASP page once only

I have an ASP page called CLIENT PAGE that calls up information from a database as well as a java applet hosted externally. The ASP page is constructed as follows:

<header.asp> is top navigation separate page with header and body tags
middle part contains tables, asp code and links to the database
<footer.asp> is a reference to asp page with footer information and closing body tag and html tag.

When you call the CLIENTPAGE.ASP, it loads the page in the browser with the URL http://www.domain.com/clientPage.asp?Client=1

When the page loads, the java applet on the page is suppose to list numerical information in a table. Upon intial loading, that information is not there, its only after refreshing the page that it appears.

I have added a javascript link to the header.asp page code to automatically refresh once after the page loads the first time,
here is the code:

================================================== ===============
var reloaded = false;
var loc=""+document.location;
loc = loc.indexOf("?reloaded=")!=-1?loc.substring(loc.indexOf("?reloaded=")+10,loc.l ength):"";
loc = loc.indexOf("&")!=-1?loc.substring(0,loc.indexOf("&")):loc;
reloaded = loc!=""?(loc=="true"):reloaded;

function reloadOnceOnly() {
    if (!reloaded)
        window.location.replace(window.location+"?reloaded =true");
================================================== ================

with: onload="reloadOnceOnly()" in the body tag

The idea is that the page laods and then reload with the java applet numbers appearing in the table.

Here is the error i get when I run this entire setup:
================================================== =
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'id = 1?reloaded=true'.

/clientPage.asp, line 8

The CLIENT PAGE is retreiving info as follows:

strClient = Request("Client")


    ' write table contents
    Set rstemp = conntemp.execute("SELECT * FROM tbl_Client WHERE id = " & strClient)
    strClientName = rstemp("ClientName")

Any assistance would be greatly appreciated


Old August 10th, 2005, 10:10 PM
Authorized User
Join Date: Jun 2003
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin

Hi Pablo,

I think your making it a bit to complicted for yourself and i presume you don't need to reload every page that uses the header.asp include.

A simple way to control this is on the initial link to the clienPage.asp pass though a variable to notify its the first time.

eg. clientPage.asp?PageStatus=firstload

Then simply add a metarefesh to execute if the variable matches first load, else just display the page.

Heres my example code

PageStatus = Request.QueryString("PageStatus")
If PageStatus = "firstload" Then
Response.Write "<meta http-equiv='refresh' content='5;url=clientPage.asp'>"
Response.Write "First time i have viewed the page, so i will re-load page in 5 seconds"
Response.Write  "The page has already been re-loaded so display the page."
End If
Old August 10th, 2005, 10:19 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

mmmm does look very confusing. To get id of your error change:
'id = 1?reloaded=true'.
'id = 1&reloaded=true'.

BTW : you have spaces in your querystring, these may cause a problem - I would want it to look like:

Wind is your friend

Similar Threads
Thread Thread Starter Forum Replies Last Post
reload parent page from included page sbkumar Javascript 2 July 24th, 2008 03:56 PM
Reload page Tooltip not work - Reload xslt file? ismailc XSLT 10 January 22nd, 2008 10:03 AM
I want page to not reload omersharp ASP.NET 2.0 Professional 0 December 13th, 2006 07:06 PM
Reload a page mivan2001 Javascript How-To 1 July 23rd, 2003 03:25 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.