473,395 Members | 1,790 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,395 software developers and data experts.

Variables retaining values

Hi,

I am relatively new to ASP.NET programming and have a problem with a web
form that I have developed:

I have a boolean variable which should be false when the application first
starts but which is set to true when I populate an array. I have an "Close
Window" command button which executes the following code:

Response.Write("<script>window.close();</script>")
If I close the form using the command button and then re-launch the
application everything works fine i.e. the variable is set back to false.
However, if I close the form by clicking the "X" in the top right corner and
re-launch the application the variable has retained it's true value from the
previous time the application was run.

Does anyone know why this is and how I can get around it?

Thanks in advance,
Damien.
Nov 18 '05 #1
5 1352
you can set that variable in the client side script.
onbodyunload - call a method to set it.

Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
Hi,

I am relatively new to ASP.NET programming and have a problem with a web
form that I have developed:

I have a boolean variable which should be false when the application first
starts but which is set to true when I populate an array. I have an "Close
Window" command button which executes the following code:

Response.Write("<script>window.close();</script>")
If I close the form using the command button and then re-launch the
application everything works fine i.e. the variable is set back to false.
However, if I close the form by clicking the "X" in the top right corner
and
re-launch the application the variable has retained it's true value from
the
previous time the application was run.

Does anyone know why this is and how I can get around it?

Thanks in advance,
Damien.

Nov 18 '05 #2
Thanks Av,

Sorry for my lack of knowledge on this, but how do I do that ?

Damien

"avnrao" <av*@newsgroups.com> wrote in message
news:Of*************@TK2MSFTNGP11.phx.gbl...
you can set that variable in the client side script.
onbodyunload - call a method to set it.

Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
Hi,

I am relatively new to ASP.NET programming and have a problem with a web
form that I have developed:

I have a boolean variable which should be false when the application first starts but which is set to true when I populate an array. I have an "Close Window" command button which executes the following code:

Response.Write("<script>window.close();</script>")
If I close the form using the command button and then re-launch the
application everything works fine i.e. the variable is set back to false. However, if I close the form by clicking the "X" in the top right corner
and
re-launch the application the variable has retained it's true value from
the
previous time the application was run.

Does anyone know why this is and how I can get around it?

Thanks in advance,
Damien.


Nov 18 '05 #3
your page body tag.
<script language='javascript'>
function setVariableToFalse()
{
yourForm.yourVariable = false;
}
</script>
<body onbeforeunload="setVariableToFalse();">

if you need any help, you can post your code here for me to understand it
better.
hth,
Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...
Thanks Av,

Sorry for my lack of knowledge on this, but how do I do that ?

Damien

"avnrao" <av*@newsgroups.com> wrote in message
news:Of*************@TK2MSFTNGP11.phx.gbl...
you can set that variable in the client side script.
onbodyunload - call a method to set it.

Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I am relatively new to ASP.NET programming and have a problem with a
> web
> form that I have developed:
>
> I have a boolean variable which should be false when the application first > starts but which is set to true when I populate an array. I have an "Close > Window" command button which executes the following code:
>
> Response.Write("<script>window.close();</script>")
>
>
> If I close the form using the command button and then re-launch the
> application everything works fine i.e. the variable is set back to false. > However, if I close the form by clicking the "X" in the top right
> corner
> and
> re-launch the application the variable has retained it's true value
> from
> the
> previous time the application was run.
>
> Does anyone know why this is and how I can get around it?
>
> Thanks in advance,
> Damien.
>
>



Nov 18 '05 #4
Thanks Av, I will give that a go!

"avnrao" <av*@newsgroups.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
your page body tag.
<script language='javascript'>
function setVariableToFalse()
{
yourForm.yourVariable = false;
}
</script>
<body onbeforeunload="setVariableToFalse();">

if you need any help, you can post your code here for me to understand it
better.
hth,
Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...
Thanks Av,

Sorry for my lack of knowledge on this, but how do I do that ?

Damien

"avnrao" <av*@newsgroups.com> wrote in message
news:Of*************@TK2MSFTNGP11.phx.gbl...
you can set that variable in the client side script.
onbodyunload - call a method to set it.

Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I am relatively new to ASP.NET programming and have a problem with a
> web
> form that I have developed:
>
> I have a boolean variable which should be false when the application

first
> starts but which is set to true when I populate an array. I have an

"Close
> Window" command button which executes the following code:
>
> Response.Write("<script>window.close();</script>")
>
>
> If I close the form using the command button and then re-launch the
> application everything works fine i.e. the variable is set back to

false.
> However, if I close the form by clicking the "X" in the top right
> corner
> and
> re-launch the application the variable has retained it's true value
> from
> the
> previous time the application was run.
>
> Does anyone know why this is and how I can get around it?
>
> Thanks in advance,
> Damien.
>
>



Nov 18 '05 #5
Hi Av,

It still doesn't work but I am sure it is my code, here it is:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ETCKMA.aspx.vb"
Inherits="ETCKMA.ETCKMA" EnableSessionState="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Keyword Maintenance</title>
<meta content="True" name="vs_showGrid">
<LINK href="CRMTemplate.css" type="text/css" rel="stylesheet">
<LINK href="CRMDialogs.css" type="text/css" rel="stylesheet">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="VBScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<script language='javascript'>
function setVariableToFalse()
{
Form1.blnKeywordArrayPopulated = false;
}
</script>
<body MS_POSITIONING="GridLayout" onbeforeunload="setVariableToFalse();">
<form id="Form1" method="post" runat="server">
<asp:label id="Label3" ... lots of controls listed
here...></asp:imagebutton></form>
</body>
</HTML>

"avnrao" <av*@newsgroups.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
your page body tag.
<script language='javascript'>
function setVariableToFalse()
{
yourForm.yourVariable = false;
}
</script>
<body onbeforeunload="setVariableToFalse();">

if you need any help, you can post your code here for me to understand it
better.
hth,
Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...
Thanks Av,

Sorry for my lack of knowledge on this, but how do I do that ?

Damien

"avnrao" <av*@newsgroups.com> wrote in message
news:Of*************@TK2MSFTNGP11.phx.gbl...
you can set that variable in the client side script.
onbodyunload - call a method to set it.

Av.
"Damien Kay" <sp**@no-spam.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I am relatively new to ASP.NET programming and have a problem with a
> web
> form that I have developed:
>
> I have a boolean variable which should be false when the application

first
> starts but which is set to true when I populate an array. I have an

"Close
> Window" command button which executes the following code:
>
> Response.Write("<script>window.close();</script>")
>
>
> If I close the form using the command button and then re-launch the
> application everything works fine i.e. the variable is set back to

false.
> However, if I close the form by clicking the "X" in the top right
> corner
> and
> re-launch the application the variable has retained it's true value
> from
> the
> previous time the application was run.
>
> Does anyone know why this is and how I can get around it?
>
> Thanks in advance,
> Damien.
>
>



Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Earl Teigrob | last post by:
I have a page that reads values from an XML file to display to the user. The page also has a control panel that allows administrators to update the XML file with new values. When an administrator...
2
by: cFleury | last post by:
This system works in a intranet w/ some 200 stations and this particular form is retaining its values among different stations...like if I enter some values in the form on station 1 walk to station...
1
by: prefersgolfing | last post by:
I have set up several session variables and can read/write as expected. My problem is when I start another debug session the variables are retaining the values from the previous debug session. I've...
4
by: triffid | last post by:
Hi, The problem I'm having is that I need to retain Javascript variables across multiple page refreshes. The obvious solution is cookies. However AFAIK, these are always sent to the server in...
3
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
Hi, Trouble in retaining values of dropdownlist, textboxes, and other controls when dropdownlist selectedindexchanged event is triggered, the controls are inside a user control and this user...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.