tailieunhanh - Wrox’s ASP.NET 2.0 Visual Web Develope 2005 Express Edition Starter Kit phần 9

chúng tôi sẽ xem làm thế nào các quản trị viên của một trang web có thể thực hiện các chỉnh sửa trên dữ liệu. Đặc biệt, chúng tôi sẽ được xem xét: ❑ ❑ Làm thế nào để thay đổi điều khiển SqlDataSource để cho phép dữ liệu chỉnh sửa Làm thế nào để cấu hình GridView để cho phép chỉnh sửa dữ liệu | Chapter 7 ItemName Itemsize ItemPrice Quantity Linevalue Carnivore Special Large T UDdate Cancel Margherita Small 1 Edit Delete Cola 16 . 1 Edit Delete Expensive beer with flavor 20 . 2 Edit Delete Figure 7-25 Editing a cart item 9. Use the Delete button to delete one of the items from the cart. How It Works The working of this is all to do with the user control and the ObjectDataSource and Gridview controls within it. The ObjectDataSource control interacts with the StoredShoppingCart class to provide read and write functionality of the cart data. The Gridview provides the interface for displaying and editing that data. What s so good about this is that you haven t had to learn anything new about the Gridview to use custom classes the grid interacts with the ObjectDataSource control which isn t very different from the SqlDataSource control. This means you have to learn only one set of techniques and makes using new objects easier. Summary We ve covered a lot of ground in this chapter and although we haven t explained all the ins and outs of the Visual Basic .NET language much of the code is simple. We started the chapter by taking a look at the order process and the idea of thinking about the requirements what is needed for ordering items and where they would be stored during the order. Having decided that custom classes were going to be used to store the shopping cart we then looked at how you create classes. We showed the creation of two classes one for the cart and one for the cart items and how you add properties and methods to them. Following that was another class to provide the storage for the cart using the Session object. We then built a page that added items into the shopping cart. This was similar to the menu page but instead of showing just the size and price of the item a link was added so that when clicked the item was added to the cart. Next was the creation of a user control .

TỪ KHÓA LIÊN QUAN