Hi
Are you declaring your columns ?
If they are automatically generated you can not use Columns for this.
How are you defining your grid in the aspx page?
From MSDN:
Explicitly declared columns may be used in conjunction with automatically
generated columns. When using both, explicitly declared columns will be
rendered first, followed by the automatically generated columns.
Automatically generated columns are not added to the Columns collection.
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
I tried that before (with the example you gave me on how to change column
height) but I get :
Index was out of range. Must be non-negative and less than the size of the
collection. Parameter name: index
To change one column, I use
DataGridAttendance.Columns[0].HeaderText = "From Date";
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
Hi,
You can use the DataGrid.Columns[ index].HeaderText
You will have to do it AFTER you call DataBind()
Pd:
If you are using TemplateColumn as the columns you better use the
<HeaderTemplate> section in the aspx page.
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
<VM> wrote in message I'm not sure I understand.
I have this code:
DataSet DSAtt = new DataSet();
OdbcDataAdapter DA2 = new OdbcDataAdapter(mySql2, myConnection);
DA2.Fill(DSAtt, "pearht");
DataGridAttendance.DataSource = DSAtt.Tables["pearht"];
DataGridAttendance.DataBind();
What would I need to add to change the Header text of each of these
columns?
Thanks.
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
Hi ,
What you mean with the column name?
The DataGrid.Columns is a collection of DataGridColumn's derived
classes,
what you can change is the HeaderText property of it.
You cannot access a column by name, only by index.
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
<VM> wrote in message How can I change the column name of a datagrid dynamically?
Thanks.