Use the template column to get the bulk to get the data in the DataGrid
Data is often required in the management of data or update the data to the data. The template column using the DataGrid control can be easily implemented. The following is a simple implementation of the data I have written to get the data in the table in paging DataGrid.
Test.aspx ...............................
DC = new Datacolumn (); dc.columnname = "file path"; dc.datatype = system.type.gettype ("system.string"); DT.COLUMNS.ADD (DC); for (int i = 0; i Private void btnimport_click (object sender, system.eventargs e) {arraylist resultarr = getodbfilelist (); for (int i = 0; i Private arraylist () {arraylist marr1 = new arraylist (); int J = DGRESULT.ITEMS.COUNT; if (DgResult.Items.count == 20) j = 20; for (int i = 0; i } .............................. I wrote the purpose of these code is to make a program that can get data in the table. Then implement the idea is to first take the table of data as the data binding source of the DataGrid. By setting the DataGrid template column joins the server-side controls of ID = "col". Use the FindControl method to get the data of the corresponding control in the DataGrid when running. The above program is only written for the acquisition control data. If you need to add a control, you can get a two-dimensional control group (which is the two-dimensional matrix structure formed by the control, how to express). . The acquisition process of the entire data requires a scan for all control data through an event trigger. For (int J = 0; i <10; i ) {for (int i = 0; i <10; i ) {txt = new textbox (); if ((Checkbox) DgResult.items [i] .findcontrol "CK")). Checked) Marr1.add (DgResult.Items [i] .cells [2] .text);}} I think this program has commonality, means if the CheckBox control is changed to other controls Other types of data can be obtained. With the Checkbox control, you can get a few rows of data for the entire DataGrid scan, then you can get the data in the table. If you are batch updates, you can bind the data on each control, then add a Button button, use the Button_Click event to trigger a scan for the control data of the entire DataGrid. But I didn't tried this. There is also the problem of Pager, in fact, 10 in FOR (int i = 0; i <10; i ) can be replaced with the number of rows of your Pager, if the setting per page 20 lines can be set this ArrayList Marr = New ArrayList () int J = dgresult.items.count; if (DgResult.Items.count == 20) J = 20; for (int i = 0; i