T
Tim
Hi,
In the below code, a count of the DataGrid1.Columns yields zero
columns even after the ItemDataBound event is raised; otherwise,
DataGrid1.DataBind() works fine if I comment out
ItemDataBoundEventHandler as a datagrid with 8 columns and 20 rows is
rendered. In the GetTable(OleDBDataReader) function, I take a dataset
and append a column that displays the row- count at the very front of
the datagrid. I want to swap this row-count column with the first
column of the dataset.
....
DataSet ds = new DataSet();
ds.Tables.Add(this.GetTable(dr));
DataGrid1.DataSource = ds.Tables[0];
DataGrid1.DataBind();
}
void ItemDataBoundEventHandler(object sender, DataGridItemEventArgs e)
{
DataGridColumn dgCol1;
DataGridColumn dgCol2;
dgCol1 = DataGrid1.Columns[0];
dgCol2 = DataGrid1.Columns[1];
DataGrid1.Columns.AddAt(0,dgCol2);
DataGrid1.Columns.AddAt(1,dgCol1);
}
In the below code, a count of the DataGrid1.Columns yields zero
columns even after the ItemDataBound event is raised; otherwise,
DataGrid1.DataBind() works fine if I comment out
ItemDataBoundEventHandler as a datagrid with 8 columns and 20 rows is
rendered. In the GetTable(OleDBDataReader) function, I take a dataset
and append a column that displays the row- count at the very front of
the datagrid. I want to swap this row-count column with the first
column of the dataset.
....
DataSet ds = new DataSet();
ds.Tables.Add(this.GetTable(dr));
DataGrid1.DataSource = ds.Tables[0];
DataGrid1.DataBind();
}
void ItemDataBoundEventHandler(object sender, DataGridItemEventArgs e)
{
DataGridColumn dgCol1;
DataGridColumn dgCol2;
dgCol1 = DataGrid1.Columns[0];
dgCol2 = DataGrid1.Columns[1];
DataGrid1.Columns.AddAt(0,dgCol2);
DataGrid1.Columns.AddAt(1,dgCol1);
}