T
Tim
Hi,
The DataGrid.Bind() below works fine as is. Now, I want to swap the
1st and 2nd columns of the DataGrid (see the commented out section):
DataSet ds = new DataSet();
ds.Tables.Add(this.GetTable(dr));
DataGrid1.DataSource = ds.Tables[0];
//DataGridColumn dgCol1;
//DataGridColumn dgCol2;
//int tryme = Convert.ToInt32(DataGrid1.Columns.Count);
//Response.Write(tryme); //returns zero
//dgCol1 = DataGrid1.Columns[0];
//dgCol2 = DataGrid1.Columns[1];
//DataGrid1.Columns.AddAt(0,dgCol2);
//DataGrid1.Columns.AddAt(1,dgCol1);
DataGrid1.DataBind();
However, DataGrid1.Columns.Count returns zero. How come? A DataGrid
with 8 columns is displayed normally.
Thanks!
The DataGrid.Bind() below works fine as is. Now, I want to swap the
1st and 2nd columns of the DataGrid (see the commented out section):
DataSet ds = new DataSet();
ds.Tables.Add(this.GetTable(dr));
DataGrid1.DataSource = ds.Tables[0];
//DataGridColumn dgCol1;
//DataGridColumn dgCol2;
//int tryme = Convert.ToInt32(DataGrid1.Columns.Count);
//Response.Write(tryme); //returns zero
//dgCol1 = DataGrid1.Columns[0];
//dgCol2 = DataGrid1.Columns[1];
//DataGrid1.Columns.AddAt(0,dgCol2);
//DataGrid1.Columns.AddAt(1,dgCol1);
DataGrid1.DataBind();
However, DataGrid1.Columns.Count returns zero. How come? A DataGrid
with 8 columns is displayed normally.
Thanks!