tailieunhanh - Beginning ASP.NET 2.0 E-Commerce in C# 2005 From Novice to Professional PHẦN 8

Điều này được đọc trong sự kiểm soát OrderDetailsAdmin để có được ID của trật tự lựa chọn. • Bạn sử dụng Page_PreRender thay vì Page_Load, vì nó thực hiện sau khi phiên được cơ hội để được cập nhật trong các hình thức mẹ. Bởi vì chúng ta đã nói chuyện về mỗi phương pháp trong khi viết mã, nó nên được khá rõ ràng | CHAPTER 12 ADDING CUSTOMER ACCOUNTS 469 Figure 12-11 . Blank user details page 26. Click Edit and enter some details as shown in Figure 12-12. 470 CHAPTER 12 ADDING CUSTOMER ACCOUNTS Figure 12-12. User details page in edit mode 27. Click Update and note how the credit card number is displayed as XXXX-XXXX-XXXX-1234. 28. Log out you should be redirected to the log in page and then log back in again as a different user. When you look at the user details for this user you should see that the details are blank they are unique to users. How It Works Implementing User Profiles for BalloonShop That was a long exercise Still at no point have you seen any particularly complicated code. In fact most of it was to make the user details edit form look good. Still there s plenty to analyze starting with the way that user profile data is exposed to the FormView control via an ObjectDataSource control. Sadly there is no direct way to bind user profile data to controls. Many methods are available for doing this for example a fellow author and friend Dave Sussman created a generic way to do this see http blogs. davids archive 2004 10 29 . You could even take the simple option ignore data binding and build a form yourself setting Text properties of TextBox or Label controls to appropriate values in the code behind. Because you have encrypted credit card details available you needed to take a slightly oblique approach to keep the data in the database secure going with the data-bound approach is also a good test for your development muscles. To start with let s look at ProfileWrapper. The code for this class starts with a reference to the SecurityLib library and a bunch of private fields. These fields cover all the fields defined in along with credit card fields obtained from the SecureCard class in the SecurityLib namespace CHAPTER 12 ADDING CUSTOMER ACCOUNTS 471 using System using using using SecurityLib summary A .