• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 27. Adding Shopping Cart Functio... > Building an ASP.NET Shopping Cart

Building an ASP.NET Shopping Cart

So far you've seen how the UltraDev Shopping Cart can help you with building a full functioning ASP shopping cart under an ASP server model. But what if you were using ASP.NET? Unfortunately, as an ASP.NET developer, you're at a slight disadvantage because free extensions currently do not exist. But who needs extensions when you can build the shopping cart just as easily using ASP.NET by hand? In the following sections we'll do just that. You'll see how with a little knowledge of DataSets and DataTables, you can easily build the ASP.NET shopping cart. Let's get started.

As you have seen in the previous chapters, DataSets provide you with a way of creating a purely memory-resident representation of a database table. DataSets, like recordsets in ASP, act as an intermediary between the database and the code. Unlike Recordsets, however, the DataSet mirrors the database more closely. DataSets contain Tables (DataTables), the DataTables contain Columns and Rows (DataColumns and DataRows), and multiple DataTables within a DataSet can even contain relationships (DataRelations). Because DataTables have columns represented by the columns property and rows represented by the rows property, DataTables will be the perfect choice when creating a shopping cart from scratch within Dreamweaver. We can build the columns just as we would within a database using the columns property of the DataTable and add rows to the DataTable with the Rows property. With the DataTable built, we can then bind the DataTable to a DataGrid to display the results in an intuitive manner. Figure 27.35 shows a simple interface that you could construct to display a list of products. You could also include a text box control to allow your users to modify the quantities for the items that they would add to the shopping cart.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint