473,692 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Losing session variable in popup

Hi,

This isn't a mission critical question but I thought I'dl throw it out there
for your feedback as it's a bit curious.

I have developed a shopping cart for an application I'm working on which is
loosely based on the e-commerce example in the quickstarts tutorial.

In the cart display I have provided functionality so that when a user clicks
on a product name a popup is opened with the full product details displayed.
Baiscally, a javascript function with the product id as an argument opens
the popup windw with the product id in the querystring so that I can display
the product details in the popup.

It then occured to me that it would be nice to provide a dropdown list in
the popup window to dsiplay the other itmes in the cart so that the user
could view the details of any of the other cart items by selecting it from
this list.

Now, my shopping cart values are stored in a session variable of a type that
exposes the icollection interface - the cart display itself is simply a
datalist databound to this icollection so I figured that I should be able to
do the same with and bind the dropdownlist.

However, when I tried my dropdown remained empty and after some detective
work I discovered that it was because my session variable appeared to be
empty in the popup page despite the fact that the shopping cart page could
read it without any problem.

So, my question is about the scope of session variables really I suppose -
does anyone have any thoughts about why my session variable wouldn't be
available to the popup window?

I look forward to hearing your thoughts,

Joe

Nov 18 '05 #1
2 6159
Joe
Can you please post the relevent sample code? specifically, the code that
generates the pop-up and then the code in the pop-up itself.

"Joe Molloy" <mo********@hot mail.com> wrote in message
news:eh******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious.

I have developed a shopping cart for an application I'm working on which is loosely based on the e-commerce example in the quickstarts tutorial.

In the cart display I have provided functionality so that when a user clicks on a product name a popup is opened with the full product details displayed. Baiscally, a javascript function with the product id as an argument opens
the popup windw with the product id in the querystring so that I can display the product details in the popup.

It then occured to me that it would be nice to provide a dropdown list in
the popup window to dsiplay the other itmes in the cart so that the user
could view the details of any of the other cart items by selecting it from
this list.

Now, my shopping cart values are stored in a session variable of a type that exposes the icollection interface - the cart display itself is simply a
datalist databound to this icollection so I figured that I should be able to do the same with and bind the dropdownlist.

However, when I tried my dropdown remained empty and after some detective
work I discovered that it was because my session variable appeared to be
empty in the popup page despite the fact that the shopping cart page could
read it without any problem.

So, my question is about the scope of session variables really I suppose -
does anyone have any thoughts about why my session variable wouldn't be
available to the popup window?

I look forward to hearing your thoughts,

Joe


Nov 18 '05 #2
Your query sounded like something I might like to do, so I gave it a try.
The following worked for me.

I created two aspx pages, PopUpTest.aspx and PopUpItem.aspx. The pertinent
code for both pages is below.

When PopUpText.aspx loads, three session variables are set as seen in the
code. Then when you click the button on the page, JavaScript is run to open
the page PopItem.aspx in a new, sized window. On PopItem.aspx is a label
containing the value for Session("PopUpT est_Name") and a dropdown list box
containing two items with values Session("Item1" ) and Session("Item2" ) .

------------------------

Code on PopUpTest.aspx :

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Session("PopUpT est_Name") = "Testing Session Variables"
Session("Item1" ) = "A " & Now.ToString
Session("Item2" ) = "B " & Now.ToString
End Sub

Private Sub btnPopUp_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnPopUp.Click
Dim scriptString As String
'scriptString = "<script language=JavaSc ript>
window.open('Po pUpItem.aspx')"
scriptString = "<script language=JavaSc ript>
window.open('Po pUpItem.aspx',' test','width=50 0,height=400,re sizable=yes,scr o
llbars=yes');"
scriptString = scriptString & "test.focus ();"
scriptString = scriptString & "</script>"
RegisterStartup Script("newwind ow", scriptString)
End Sub
---------------------------

Code on PopUpItem.aspx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Me.Label1.Text = "Session Variable 'PopUpTest_Name ' has value: " &
Session("PopUpT est_Name")
Me.DropDownList 1.Items.Clear()
Me.DropDownList 1.Items.Add(Ses sion("Item1"))
Me.DropDownList 1.Items.Add(Ses sion("Item2"))
End Sub

"Joe Molloy" <mo********@hot mail.com> wrote in message
news:eh******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious.

I have developed a shopping cart for an application I'm working on which is loosely based on the e-commerce example in the quickstarts tutorial.

In the cart display I have provided functionality so that when a user clicks on a product name a popup is opened with the full product details displayed. Baiscally, a javascript function with the product id as an argument opens
the popup windw with the product id in the querystring so that I can display the product details in the popup.

It then occured to me that it would be nice to provide a dropdown list in
the popup window to dsiplay the other itmes in the cart so that the user
could view the details of any of the other cart items by selecting it from
this list.

Now, my shopping cart values are stored in a session variable of a type that exposes the icollection interface - the cart display itself is simply a
datalist databound to this icollection so I figured that I should be able to do the same with and bind the dropdownlist.

However, when I tried my dropdown remained empty and after some detective
work I discovered that it was because my session variable appeared to be
empty in the popup page despite the fact that the shopping cart page could
read it without any problem.

So, my question is about the scope of session variables really I suppose -
does anyone have any thoughts about why my session variable wouldn't be
available to the popup window?

I look forward to hearing your thoughts,

Joe


Nov 18 '05 #3

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

Similar topics

1
2779
by: Scott Lyon | last post by:
I'm maintaining (read: I didn't write it, nor do I have the time to spend to rewrite it) an application that is suddenly giving me grief. The reason I say suddenly, is because we're in the process of transitioning the server on which it runs from Microsoft Windows 2000 Server, to 2003 server (going from IIS 5 to IIS 6). This problem hasn't really occurred on the 2000 server machine, but it's happening MUCH more on the new 2003 box (not...
2
3304
by: Terry | last post by:
When launching our application with Internet Explorer already opened, but not pointing to our web server, the session variables disappear. If you open I.E. after launching our app, it works fine. It also works fine if you have the option set to 'Reuse Windows for Lauching Shortcuts' checked in the I.E. properties and launch our app from a shortcut, but it fails it you launch it from the I.E. favorites or some other method that won't take...
2
1806
by: James | last post by:
Session("UserName") is set when someone logs in. Get to a page that displays a record where you can type a comment. The form has an onSubmit event that calls a javascript function. That function sets a javascript variable called beenChecked = true and then calls a PopUp window to spell check the comment. When it's done spell checking, it calls the submit method on the form tag of the opening window. The method evaluates that it's...
9
4718
by: Jimmy Junatas | last post by:
When we open a window (using client-side jscript ie. window.open("/Site/Popup.aspx?...",...)) from Page1.aspx, the called page Popup.aspx does not have access to the Session variables present in Page1.aspx. The IIS Log shows (listed below) shows that the ASP.NET_SessionId cookie is not present in Popup.aspx. The thing is that this mechanism works for 99% of our users. There is this one user that is consistently having this problem. ...
4
2163
by: Stephen | last post by:
I have a .NET (1.1 framework) application that is losing a session variable on only a few PC's. The main page is loading up in a frame in a Portal application. On the Page_Load it stores an object with the user id and password into the session. The web page includes a set of links. When the user clicks on a link, another page within this application is opened in a new window. On the Page_Load of this second page, I am retrieving...
4
2403
by: Keith-Earl | last post by:
I have been writing ASP.NET apps since the RTM build and have never seen this. I built a simple app that uses session variables on my DEV laptop. All runs well. I have a simple toggle routine that checks the status of a Session variable. I keep losing the value of the variable. When I trace the page it is there, but it is gone next postback. Also, I use three tier objects and store my DataManager object in a session variable. It is...
9
2540
by: Adrian Parker | last post by:
We have a website that works everywhere but on a few PCs on this one site.. Asp.Net 1.1 Server = Windows 2003 Client = XP In the web.config we use - cookieless="false" in the browser settings they have "Always allow session cookies" set to true When the browser connects to the website the first page sets a session variable called "user_ref" to something and then calls another page. If on
0
1393
by: Jimmy Reds | last post by:
Hi, Sorry if this appears twice but I post through Google Groups and it had a funny 5 minutes and didn't appear to post this message the first time. I am setting session variables on a page then doing a header/location redirect to a second page however I am losing one of my session variables. Not all of them, just one.
2
1558
by: Jimmy Reds | last post by:
Hi, I am setting session variables on a page then doing a header/location redirect to a second page however I am losing one of my session variables. Not all of them, just one. Here are some details/comments: I am doing a session_start() on ALL of my pages, right at the top of each page
0
8546
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9090
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8969
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8811
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8810
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5822
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2981
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1962
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.