TAILIEUCHUNG - ASP.NET 4 Unleased - p 83

Việc kiểm soát ObjectDataSource bao gồm một tài sản DataObjectTypeName. tài sản này có chứa tên của một đối tượng sử dụng với các UpdateEmployee () phương pháp. Khi UpdateEmployee () được gọi là, một thể hiện của các thành phần CompanyEmployee được tạo ra và được truyền cho phương pháp này. | 794 CHAPTER 18 Using the ObjectDataSource Control The ObjectDataSource control includes a DataObjectTypeName property. This property contains the name of an object used with the UpdateEmployee method. When the UpdateEmployee method is called an instance of the CompanyEmployee component is created and passed to the method. NOTE The DataObjectTypeName property has an effect on only the methods represented by the InsertMethod UpdateMethod and DeleteMethod properties. It does not have an effect on the method represented by the SelectMethod property. There is one important limitation when using the DataObjectTypeName property. The object represented by this property must have a parameterless constructor. For example you could not use the following CompanyEmployee class with the DataObjectTypeName property public class CompanyEmployee private string _firstName public string FirstName get return _firstName public void CompanyEmployee string firstName _firstName firstName The problem with this class is that it initializes its FirstName property in its constructor. Its constructor requires a firstName parameter. Instead you need to use a class that looks like this public class CompanyEmployee private string _firstName From the Library of Wow eBook Paging Sorting and Filtering Data with the ObjectDataSource Control 795 public string FirstName get return _firstName set _firstName value This class has a parameterless constructor. The FirstName property is a read write property. If you have the need you can get around this limitation by handling the Inserting Updating or Deleting event. When you handle one of these events you can pass any object that you need to a method. These events are discussed later in this chapter in the section Handling ObjectDataSource Events. Paging Sorting and Filtering Data with the ObjectDataSource Control The ObjectDataSource control provides you with two options for paging and sorting database data. You can take advantage of either user interface

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.