TAILIEUCHUNG - ASP.NET 4 Unleased - p 164

Các LoadPostData () nhận dạng các lĩnh vực đăng từ trình duyệt. Phương pháp trong Ví dụ 36,16 là đã thông qua một bộ sưu tập của tất cả các trường mẫu được đưa lên máy chủ. postDataKey đại diện cho tên của các trường tương ứng với sự kiểm soát hiện hành. | 1604 CHAPTER 36 Building Custom Controls Text postCollection postDataKey return true return false public void RaisePostDataChangedEvent if TextChanged null TextChanged this The LoadPostData receives the form fields posted from the browser. The method in Listing is passed a collection of all the form fields posted to the server. The postDataKey represents the name of the field that corresponds to the current control. NOTE If the name of a form field rendered by a control does not match the name of the control you need to notify the page containing the control to pass the form data to the control. You can call the method inside or before the control s PreRender event to notify the page that the control is interested in receiving the postback data. In other words if you discover that your control s LoadPostData method is never called call the method in your control. If the value of the form field has changed in other words it does not match the current value of the control s Text property the Text property is updated and the method returns the value True. Otherwise the method returns the value False. When the LoadPostData method returns True the RaisePostDataChangedEvent method is executed. Typically you implement this method to raise a change event. In Listing this method is used to raise the TextChanged event indicating that the contents of the TextBox have been changed. The page in Listing illustrates how you can use the custom TextBox control in a page see Figure . From the Library of Wow eBook Processing Postback Data and Events 1605 FIGURE Handling postback data. LISTING 36 @ Page Language C @ Register TagPrefix custom Namespace myControls DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD script runat server protected void CustomTextBox1_TextChanged object sender EventArgs

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.