Created a shopping cart in a Session ASP.Net how to move it to another page?
-
My professor gave us a code for a shopping cart that he created in a Session but I was wondering how can I make the data of the shopping cart to show on another page called (CheckOut.aspx), I plan the user to click on a button and be directed to this page to complete the purchase. Code on the first page : Server.Transfer("CheckOut.aspx") Code on the CheckOut.aspx page: Response.Write(Request.Form(Session("Car… - but it doesn't work. Shopping cart: Function makeCart() 'make a table in memory that will represent the cart objDT = New System.Data.DataTable("Cart") objDT.Columns.Add("ID", GetType(Integer)) objDT.Columns("ID").AutoIncrement = True objDT.Columns("ID").AutoIncrementSeed = 1 objDT.Columns.Add("Quantity", GetType(Integer)) objDT.Columns.Add("Product", GetType(String)) objDT.Columns.Add("Cost", GeType(Decimal)) 'put the cart in the session object Session("Cart") = objDT
-
Answer:
DataBind a DataGrid to the DataTable. I.e. drop a DataGrid from the Toolbox on the aspx page in the designer and write the following code in the Page_Load event. Pseudo-code: if not Page.IsPostBack myDataGrid.DataSource = Session("Cart") myDataGrid.DataBind() end if You have to type-cast the Session object to the DataTable, of course. Hope this helps.
Juan at Yahoo! Answers Visit the source
Related Q & A:
- Do you know of a software similar to coffeecup shopping cart?Best solution by Yahoo! Answers
- How to show a table on another page?Best solution by Stack Overflow
- How can I add the data to shopping cart?Best solution by Stack Overflow
- How to move completely move a folder to one place or another?Best solution by Stack Overflow
- How to Use my shopping cart and store with my Affiliate program?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.