User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 397,983 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,708 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1499 | Replies: 5
Reply
Join Date: Sep 2005
Posts: 4
Reputation: SLG29 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SLG29 SLG29 is offline Offline
Newbie Poster

Session variables

  #1  
Sep 23rd, 2007
I wonder if anyone can help with this problem I have

I'm trying to create a shopping cart with session variables, there are 5 buttons on the form and by clicking 1 of these displays the relevant product and price in session variables in textboxes on the next form, the product list is in an XML file, I can load 1 selection fine but can't seem to load the session variables for the other buttons depending on what button is clicked

Does anybody have any tips/advice on how to overcome the problem

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: England
Posts: 153
Reputation: ptaylor965 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Session variables

  #2  
Sep 23rd, 2007
I would not recommend using the Session command for storing product related information

I would use the query string
ie. http://www.taylorsnet.co.uk/SourceCo...spx?SourceID=5

So that if a customer bookmarks that page it will forget the session but will still retain the info from the query string

the page can access the query string from
request("productid")
Then get the product page to pull the data from the XML file

multiple query strings can be added by separating them by a &
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote  
Join Date: Sep 2005
Posts: 4
Reputation: SLG29 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SLG29 SLG29 is offline Offline
Newbie Poster

Re: Session variables

  #3  
Sep 23rd, 2007
Thanks for the reply

This is an assignment I'm doing and the requirement is for session variables, as you're saying you wouldn't normally do this in the real world

Is there a way I can load the session variables depending on what button is clicked on the first form

Thanks
Reply With Quote  
Join Date: Oct 2006
Location: England
Posts: 153
Reputation: ptaylor965 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Session variables

  #4  
Sep 23rd, 2007
In this case I would have a common session variable

On first page
public sub button1_click
session("Clicked") = "button1"
end sub

public sub button2_click
session("Clicked") = "button2"
end sub

public sub button3_click
session("Clicked") = "button3"
end sub


On second page
public sub page_load
if session("Clicked").tostring = "button1" then
'run these sessions
elseif session("Clicked").tostring = "button2" then
'run these sessions
 elseif session("Clicked").tostring = "button3" then
'run these sessions
 else
response.redirect("firstpage.aspx")
end if
end sub
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote  
Join Date: Sep 2005
Posts: 4
Reputation: SLG29 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SLG29 SLG29 is offline Offline
Newbie Poster

Re: Session variables

  #5  
Sep 23rd, 2007
Thank-you for your help, the products and prices are appearing in the textboxes now, to complete the assignment I need to do the following:

On the order form with the relevant product and price in the textboxes a quantity is entered, when add to basket link is clicked the user is taken to the shopping basket form which is the last form in the application showing the contents of their order, (Description, price, quanity and total) in a datagrid with a text box also showing the order value

The user can then either click place order, this then results in an email being sent with the order details and taken to a conformation page, the basket should then be cleared

The other option is to click carry on shopping, the user is then taken back to the products page and allowed to add further contents to the shopping basket

Any tips/advice on how to approach this would be appreciated, I'm not looking to be spoon fed the answer, just need a guide being new to the language

Thanks
Reply With Quote  
Join Date: Oct 2006
Location: England
Posts: 153
Reputation: ptaylor965 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Session variables

  #6  
Sep 23rd, 2007
To send E-Mails lookup these Variables

Dim EMail As New System.Net.Mail.MailMessage
Dim SMTPServer As New System.Net.Mail.SmtpClient
Dim Authentication As New Net.NetworkCredential("login name/email", "password")


The rest is quite easy once you know the Variables
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 1:07 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC