Thursday, June 14, 2007

Adding Columns to a GridView

Working with the new GridView control, I was struggling for a while with the change from the DataGrid OM...

Using the BoundField object solved the problem..

BoundField newField = new BoundField();
newField.DataField = thisColumn.DataColumnName;
newField.HeaderText = thisColumn.DisplayName;
grdResults.Columns.Add(newField);

No comments: