日期:2014-05-17 浏览次数:20914 次
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = GetDataTable();
GridColumn gridColumn;
gridView1.OptionsBehavior.AutoPopulateColumns = false;
int visibleIndex = 0;
foreach (DataColumn col in dt.Columns)
{
gridColumn = new GridColumn();
gridColumn.Name = gridColumn.Caption = gridColumn.FieldName = col.ColumnName;
gridColumn.VisibleIndex = visibleIndex;
gridView1.Columns.Add(gridColumn);
visibleIndex++;
}
gridControl1.DataSource = dt;
}