tailieunhanh - Work with Data-Bound Multi-Select List Boxes Using Web Forms
Làm việc với Danh sách Multi-Chọn Data-Bound Boxes Sử dụng Web với hình thức như thế nào-to , ví dụ này sẽ cho bạn thấy làm thế nào để tận dụng lợi thế của các hộp danh sách đa lựa chọn, chỉ với một mẫu Web thay vì một mẫu Windows | Work with Data-Bound Multi-Select List Boxes Using Web Forms As with How-to this example will show you how to take advantage of multi-select list boxes only with a Web Form instead of a Windows Form. You need to be able to manipulate multi-select list boxes in your Web applications using as well as in your Visual Basic .NET desktop applications. This How-To shows you how to use just about the same coding techniques as in How-To but with the change of using the Web Form. Technique When you are performing a task in a Web Form that you have created in a Windows Form you would think it would take the same effort-if not more-to accomplish the task. However this is not the case for this How-To. The commands available to the Windows Form ListBox control will give better performance because you have a SelectedIndexes collection to work with and in the Web Form you iterate through all the items in the ListBox control and check the Selected property. Nonetheless coding on the Web Form is simpler. Unlike the Windows Form version of the ListBox Control which has four different settings for the SelectionMode property the Web Form version has two Single or Multiple. Another thing to keep in mind when developing with data and the Web Form is that you will need to use the DataBind method off the ListBox control to bind the data at runtime. In the Load event of the page you will want to use the IsPostBack method of the page to ensure that you perform certain tasks only when the page is initially loaded and not on a round trip that pages take back to the server. Steps Open and run the -Chapter 8 solution. From the main Web Form click on the hyperlink with the caption How-To Work with Data-Bound Multi-Select List Boxes Using a Web Form. You will then see the page displayed in Figure . Figure . This Web Form uses controls bound at runtime and takes advantage of multi-select list boxes. When the page loads you will see the Beverages category chosen
đang nạp các trang xem trước