TAILIEUCHUNG - Add, Edit, and Delete Data Using the DataGrid Control

5,7 Thêm, Sửa Đổi, và Xóa dữ liệu Sử dụng DataGrid Control Bảng điều khiển và DataRepeater cũng tốt khi tôi đã tập hợp dữ liệu nhỏ, nhưng màn hình hiển thị chỉ cần giữ đi và về, và tôi phải viết một loạt các mã để thay đổi phân loại thứ tự của dữ liệu | Add Edit and Delete Data Using the DataGrid Control The Table controls and DataRepeater are fine when I have small sets of data but the display just keeps going on and on and I have to write a bunch of code to change the sort order of the data. How do I create a table-like display that will show a set number of rows at a time and let me sort the data Technique One of the nice things about the DataGrid control that makes it so much more powerful than the other list controls is its ability to add edit and delete directly within the control. This How-To shows you how to create columns to manage your data using the DataGrid control. Adding Buttons to the DataGrid Control You will use the DataGrid control with more code this time so that you can work with data more. You will also be adding a couple of buttons to the DataGrid display to allow you to edit delete and update data. You will add buttons to the data grid by right-clicking on the control choosing Property Builder and then choosing the Columns tab. You can then select from the list of button types see Figure . Figure . The buttons listed in Selected Columns are being used for this example. Note Be sure to leave the Create Columns Automatically at Run Time check box checked. Unless you specify other columns or have the data loaded at run-time you will end up with just the buttons which would be pretty boring. Using Events with Buttons on the Data Grid After you have selected to include buttons in the data grid you not only have to add the code to the events for the specific buttons but you also have to make sure that knows the events to use. You can do this in a couple of ways. One way is to set the AutoEventWireUp attribute of the page to True. You can see this attribute in the first line of the Web page. By default the attribute is set to False. After you add the buttons to the data grid you will see the buttons in the DataGrid control. @ Page Language vb AutoEventWireup false Codebehind .

Đã 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.