Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 12

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Trình Mẫu dữ liệu Khung ASP.NET bao gồm ba điều khiển bạn có thể sử dụng để gửi một hình thức để các máy chủ: Button, LinkButton, và ImageButton. Những điều khiển này có chức năng tương tự, nhưng kiểm soát từng có một vẻ ngoài khác biệt. Trong phần này, bạn học cách sử dụng mỗi ba loại nút trong một trang. Tiếp theo, bạn tìm hiểu làm thế nào để kết hợp kịch bản phía máy khách với các điều khiển Button phía máy chủ | 84 CHAPTER 2 Using the Standard Controls Submitting Form Data The ASP.NET Framework includes three controls you can use to submit a form to the server Button LinkButton and ImageButton. These controls have the same function but each control has a distinct appearance. In this section you learn how to use each of these three types of buttons in a page. Next you learn how to associate client-side scripts with server-side Button controls. You also learn how to use a button control to post a form to a page other than the current page. Finally you learn how to handle a button control s Command event. Using the Button Control The Button control renders a push button that you can use to submit a form to the server. For example the page in Listing 2.14 contains a Button control. When you click the Button control the time displayed by a Label control is updated see Figure 2.10 . LISTING 2.14 ShowButton.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 btnSubmit_Click object sender EventArgs e lblTime.Text DateTime.Now.ToString T script html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Show Button title head body form id form1 runat server div asp Button id btnSubmit Text Submit OnClick btnSubmit_Click Runat server br br From the Library of Wow eBook Submitting Form Data 85 asp Label id lblTime Runat server div form body html 2 FIGURE 2.10 Displaying a Button control. The Button control supports the following properties this is not a complete list AccessKey Enables you to specify a key that navigates to the Button control. CommandArgument Enables you to specify a command argument passed to the Command event. CommandName Enables you to specify a command name passed to the Command event. Enabled Enables you to disable the Button control. OnClientClick Enables you to specify a client-side script that executes when the button is clicked. .

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.