Get the data in the DataGrid Control Module column
In the DataGrid, you can only get the data of each row, if you want to get the data in the DataGrid control, you must scan the controls of each template column to get the data. The procedure I want to do is based on the number of lines, by the user enters several data at a time, and the system automatically obtains a bulk data. The following procedures simply express the functions that need to be implemented.
Test.aspx
........
ASP: TemplateColumn Headertext = "Delicad Point Accuracy">
Test.aspx.cs
Private Void Page_Load (Object Sender, System.EventArgs E) {// Place the user code here to initialize the page if (! ispostback) mfbind (Datasource ());
Private ilist datasource () {dataable dt = new data (); Datacolumn DC = new Datacolumn (); dc.columnname = "id"; dc.datatype = system.type.gettype ("system.int32"); Dc.ReadOnly = true; dc.unique = true; dc.autoincrement = true; dc.autoincrementseed = 0; dc.autoincrementstep = 1; DT.COLUMNS.ADD (DC);
DC = new datacolumn (); dc.columnname = "column name"; dc.datatype = system.type.gettype ("system.string"); dt.columns.add (dc); for (int i = 0; i <10; i ) {DATAROW DR = DT.NEWROW (); DR [1] = i; dt.Rows.add (dr);} session ["source"] = dt; return dt.defaultView;} private void mfbind (IList dv) {this.dgResult.DataSource = (DataView) dv; this.dgResult.DataBind ();} private void btnOK_Click (object sender, System.EventArgs e) {// string tmpa = dgResult__ctl2_col1.Text; TextBox txt; ArrayList Marr = new arraylist (); for (int i = 0; i <10; i ) {txt = new textbox (); txt = (TextBox) DgResult.items [i] .findControl ("col"); MARR. Add (Txt.Text);} for (int i = 0; i