assume you are talking about the DataGrid in ASP.NET, >>>给控件添加行
add extra rows to your DaTable>>>控件添加列
add additional Cell to DataGridItemEventArgs.Item.Cells collection in ItemCreated or ItemDataBound event handler>>>怎样得到某单元的值
use DataGrid.Items[nIndex].Cells[n].Text
add extra rows to your DaTable>>>控件添加列
add additional Cell to DataGridItemEventArgs.Item.Cells collection in ItemCreated or ItemDataBound event handler>>>怎样得到某单元的值
use DataGrid.Items[nIndex].Cells[n].Text
===>
add extra rows to your DataTable
在DataGrid的DataSet中的表中增加行列即可
DataGrid DG;
Ds = new DataSet("Ds");
Ds.Tables.Add(new DataTable("Tab"));//
//动态添加列
DCol = new DataColumn();
DCol.DataType = System.Type.GetType("System.String");
DCol.ColumnName = "日期";
DCol.Caption = "日期";
Ds.Tables["Tab"].Columns.Add(DCol);//
//动态添加行
DRow = Ds.Tables["Tab"].NewRow();
Ds_Kh.Tables["Tab_Kh"].Rows.Add(DRow);DG.DataSource = Ds;
DG.DataBind();