Working with items on a form.

NickMalloy
NickMalloy used Ask the Experts™
on
I have a form where a person can add multipe items (almost like a shoping cart). The user enters all the info for the item, so they are not selecting items. There are other parts of the form, but I want to store all the items in it's own table. What's the best way to store the items temporarily, since I want have an associated Rec for the rest of the form. I also want to display the items they create as they are creating them, I just can't wrap my head around how to do this. Any help would be great!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
as I understand you need to store the temp data on Data table and then save this temp table in session to use it on other pages

NickMalloySystems Lead

Author

Commented:
I think I would want to take the temp table and write it to a database? Any good examples of working with temp tables, I haven't had to do that?
DataTable dtOrders = new DataTable(); //Create Table Object
                
                dtOrders.Columns.Add("pointOfSalesSysId"); //Add new column to table
                dtOrders.Columns[0].DataType = System.Type.GetType("System.Int32"); // Declare the data column type
                dtOrders.Columns.Add("pointOfSales");
                dtOrders.Columns[1].DataType = System.Type.GetType("System.String");

                dtOrders.Columns.Add("brandSysId");
                dtOrders.Columns[2].DataType = System.Type.GetType("System.Int32");
                dtOrders.Columns.Add("brand");
                dtOrders.Columns[3].DataType = System.Type.GetType("System.String");

 DataRow dr = dtOrder.NewRow(); //create new row

//Add Data To row
 dr[0] = 0;
                    dr[1] = "X";
                    dr[2] = 2;
                    dr[3] = "Z";
dtOrder.Rows.Add(dr); // Add row to table
 Session["dtOrders"] = dtOrder; // Add table to session to save data and use it outside the page

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial