TAILIEUCHUNG - BeginningASP.NET 2.0 with C# PHẦN 8

Web dịch vụ có thể hình thành một thư viện hoặc kho lưu trữ chia sẻ thông tin có thể được bất cứ điều gì từ dự báo thời tiết mới nhất, một bản đồ của các tiện ích địa phương của bạn, một chức năng tính toán toán học, các bài hát và bìa album của đĩa CD mà bạn vừa đưa vào CD-ROM. | E-Commerce Figure 13-31 7. Type 2 and click Update. The totals are updated as shown in Figure 13-32. Figure 13-32 8. Click Delete. The item is removed from your cart. How It Works By adding two bits to the application in this Try It Out you enabled the whole functionality of the shopping cart. You started by adding a button to the Product Item page and creating some code that ran when the button was clicked. The code handles the business of adding an item to your shopping cart. You start by getting the Price ProductName PictureUrl and ProductID double Price Label 0 .FindControl PriceLabel .Text string ProductName Label 0 .FindControl NameLabel .Text string PictureURL Label 0 .FindControl PictureUrlLabel .Text int ProductID ProductID 501 Chapter 13 This information has already been stored in the page. You use the FindControl method of a control to locate a control. The DataList control contains an item template so you have to move into the controls collection of the DataList control to get at the Label controls. You can cast the contents of the control to text by prefixing them with the control type in brackets. So each of the three lines works like this. You declare a variable in which to store your item. You search the DataList control for your Label control using FindControl and supply it with the name of the control you want to find. You convert the control from a generic control into a specific Label control. Note that this only works if the control you are casting to actually is a Label control. So for the Price you search for the PriceLabel control s contents and you retrieve the text property of the label. There is actually another level of conversion required here. You want the price as a double data type so you convert the text item you receive into a double and store it in the double data type. The PictureUrlLabel is the one you didn t delete in the second

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.