M
mohaaron
Does anyone know how I get can to the column alias in a datatable?
here is an example of what I need to do.
Query:
select Column1 as [My Column 1], Column2 as [My Column 2] from
dbo.tablename
Now I need to generate the BoundFields after the query is executed.
foreach (DataColumn column in dataView.Table.Columns)
{
BoundField boundField = new BoundField();
boundField.DataField = column.ColumnName;
boundField.HeaderText = column.Alias;
this.searchGrid.Columns.Add(boundField);
}
The problem is that there is no column.Alias so how can I get the
original column name for the DataField and then the Alias for the
HeaderText?
thanks
here is an example of what I need to do.
Query:
select Column1 as [My Column 1], Column2 as [My Column 2] from
dbo.tablename
Now I need to generate the BoundFields after the query is executed.
foreach (DataColumn column in dataView.Table.Columns)
{
BoundField boundField = new BoundField();
boundField.DataField = column.ColumnName;
boundField.HeaderText = column.Alias;
this.searchGrid.Columns.Add(boundField);
}
The problem is that there is no column.Alias so how can I get the
original column name for the DataField and then the Alias for the
HeaderText?
thanks