I've heard of session variables being lost, but I've got one that keeps comi
ng back after I've deleted it. I'm using a session variable as a flag betwe
en a popup window and its parent window. The session variable is created in
the popup window with a va
lue of 100. The popup window is then closed. When this happens, a postback
occurs in the parent window. In the Page Load function of the parent windo
w, there is a check to see if the session variable is equal to 100. If it i
s, I save some data and set
the session variable to 0. Then I delete the session variable using Session
.Remove. I followed the values of the session variable in my debugger and it
comes back as 0 and then Nothing as expected.
The problem happens when I've finished with that and I click on another butt
on. The Page Load function runs again and when it gets to the check for the
session variable, it's still there, and it still equals 100, even though it
was set to zero and then d
eleted.
Is this behavior caused by my trying to modify a session variable that was c
reated in a different window? Or is it something else?What code did you use to call your second window?
"LKB" <anonymous@.discussions.microsoft.com> wrote in message
news:52266907-DC7B-406B-8E73-FEAF49651B1B@.microsoft.com...
> I've heard of session variables being lost, but I've got one that keeps
coming back after I've deleted it. I'm using a session variable as a flag
between a popup window and its parent window. The session variable is
created in the popup window with a value of 100. The popup window is then
closed. When this happens, a postback occurs in the parent window. In the
Page Load function of the parent window, there is a check to see if the
session variable is equal to 100. If it is, I save some data and set the
session variable to 0. Then I delete the session variable using
Session.Remove. I followed the values of the session variable in my debugger
and it comes back as 0 and then Nothing as expected.
> The problem happens when I've finished with that and I click on another
button. The Page Load function runs again and when it gets to the check for
the session variable, it's still there, and it still equals 100, even though
it was set to zero and then deleted.
> Is this behavior caused by my trying to modify a session variable that was
created in a different window? Or is it something else?
>
The code for the second window was javascript. I'd love a way to do it strai
ght from the CodeBehind VB, but I haven't found a way to make that work yet.
Here's the Javascript function I used:
function PopUp(winWidth, winHeight, sURL)
{
var winLeft = (screen.width-winWidth)/2;
var winTop = (screen.height-winHeight)/2;
var sName = "_blank";
var sFeatures = "menubar=0, toolbar=0, titlebar=1, resizable=0, scrollbars=0
";
var sSizes = " width=" + winWidth + ",height=" + winHeight + ",top=" + winTo
p + ",left=" + winLeft;
sFeatures = sFeatures + sSizes;
win1 = window.open(sURL, sName, sFeatures);
}
In the VB, I put this line in the Page Load:
Button1.Attributes.Add("OnClick", "PopUp(375, 200, 'PopUp.aspx')")
-- YouKnowIt wrote: --
What code did you use to call your second window?
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment