TAILIEUCHUNG - ASP.NET 4 Unleased - p 6

Bạn cần hiểu rằng tất cả các kiểm soát các sự kiện xảy ra trên máy chủ. Ví dụ, sự kiện Click không được đưa lên khi bạn thực sự nhấn vào một nút. Các sự kiện Click không được đưa lên cho đến khi trang chứa button được đăng trở lại máy chủ. Khung là một trang web phía máy chủ ứng dụng | 24 CHAPTER 1 Overview of the Framework FIGURE Adding an event handler from Source view. In Design view you can double-click a control to add a handler for the control s default event. Double-clicking a control switches you to Source view and adds the event handler. Finally from Design view after selecting a control on the designer surface you can add an event handler from the Properties window by clicking the Events button the lightning bolt and double-clicking next to the name of any of the events see Figure . FIGURE Adding an event handler from the Properties window. From the Library of Wow eBook Understanding Controls 25 You need to understand that all control events happen on the server. For example the Click event is not raised when you actually click a button. The Click event is not raised until the page containing the Button control is posted back to the server. The Framework is a server-side web application framework. The .NET Framework code that you write executes on the server and not within the web browser. From the perspective of nothing happens until the page is posted back to the server and can execute within the context of .NET Framework. Notice that two parameters are passed to the btnSubmit_Click handler in Listing . All event handlers for controls have the same general signature. The first parameter the object parameter named sender represents the control that raised the event. In other words it represents the Button control that you clicked. You can wire multiple controls in a page to the same event handler and use this first parameter to determine the particular control that raised the event. For example the page in Listing includes two Button controls. When you click either Button control the text displayed by the Button control is updated see Figure . u FIGURE Handling two Button controls with one event handler. LISTING @ Page Language C DOCTYPE

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.