Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
ASP.NET 4 Unleased - p 13
Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 13
Nhã Sương
159
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Sử dụng Client Scripts với nút điều khiển Tất cả ba nút điều khiển hỗ trợ một tài sản OnClientClick. Bạn có thể sử dụng tài sản để thực hiện bất kỳ mã phía máy khách mà bạn cần khi nút được nhấn. Các trang trong Ví dụ 2,18 minh họa làm thế nào bạn có thể sử dụng tài sản OnClientClick để hiển thị một hộp thoại xác nhận (xem hình 2.14). | 94 CHAPTER 2 Using the Standard Controls Using Client Scripts with Button Controls All three Button controls support an OnClientClick property. You can use this property to execute any client-side code that you need when a button is clicked. The page in Listing 2.18 illustrates how you can use the OnClientClick property to display a confirmation dialog box see Figure 2.14 . LISTING 2.18 ButtonOnClientClick.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN http www.w3.org TR xhtml1 DTD xhtml1-transitional.dtd script runat server protected void btnDelete_Click object sender EventArgs e lblResult.Text All pages deleted script html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Button OnClientClick title head body form id form1 runat server div asp Button id btnDelete Text Delete Website OnClick btnDelete_Click OnClientClick return confirm Are you sure Runat server br br asp Label id lblResult Runat server div form body html From the Library of Wow eBook Submitting Form Data 95 FIGURE 2.14 Displaying a client-side confirmation dialog box. 2 In Listing 2.18 the Button control includes an OnClientClick property which executes a JavaScript script when you click the button on the client. The script displays a confirmation dialog box. If the confirmation box returns False the button click is canceled and the form containing the button is not posted to the server. Because the button controls like most ASP.NET controls support expando attributes you can handle other client-side events simply by adding an arbitrary attribute to the control. If ASP.NET Framework does not recognize an attribute declared on a button control the framework simply passes the attribute to the browser. For example the page in Listing 2.19 contains a button control that includes onmouseover and onmouseout attributes. When you hover your mouse over the button the text displayed in the button is changed. LISTING 2.19 ButtonExpando.aspx @ Page Language C .
TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã 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.