TAILIEUCHUNG - ASP.NET 4 Unleased - p 49

Using List Controls SelectCommand=”SELECT Id, Title FROM Movies” ConnectionString=”” Runat=”server” / When you enable the AutoPostBack property, a JavaScript onchange() event handler is added to the List control. The onchange event is supported by all recent browsers including Firefox and Opera . The DropDownList control has a SelectedIndexChanged event handler named ddlMovies_SelectedIndexChanged(). The SelectedIndexChanged event is raised whenever you make a new selection in the List control (independent of the AutoPostBack property). The ddlMovies_SelectedIndexChanged() method displays the selected list item in a Label control. WEB STANDARDS NOTE You should avoid using the AutoPostBack property because it creates accessibility problems. | 454 CHAPTER 10 Using List Controls SelectCommand SELECT Id Title FROM Movies ConnectionString ConnectionStrings Movies Runat server div form body html When you enable the AutoPostBack property a JavaScript onchange event handler is added to the List control. The onchange event is supported by all recent browsers including Firefox and Opera . The DropDownList control has a SelectedIndexChanged event handler named ddlMovies_SelectedIndexChanged . The SelectedIndexChanged event is raised whenever you make a new selection in the List control independent of the AutoPostBack property . The ddlMovies_SelectedIndexChanged method displays the selected list item in a Label control. WEB STANDARDS NOTE You should avoid using the AutoPostBack property because it creates accessibility problems for persons with disabilities. If you can t use a mouse and you are interacting with a website through the keyboard having a page post back to the server whenever you make a selection change is a frustrating experience. Using the Items Collection All the list items rendered by a List control are contained in the List control s list item collection. This collection is exposed by the Items property. You can work directly with the list items in this collection. For example you can add or remove particular list items or you can change the order of the list items. The page in Listing contains two ListBox controls and two button controls. When you click the Add button a list item is moved from the first ListBox to the second ListBox control. When you click Remove the list item is moved back to the original List control see Figure . From the Library of Wow eBook Overview of the List Controls 455 FIGURE Using the ListPicker to select list items. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD script runat server summary Move item from All Movies to Favorite Movies summary protected void .

TÀI LIỆU MỚI ĐĂNG
41    188    5    27-12-2024
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.