I'm new to ASP.NET, so this might be a very silly question.
We have an application that spits out a text file in a tabular format. I'm working on an app that will grab that text file and display it in a datagrid that can be sorted. I got the reading in of the text file and the displaying in a datagrid done with no problems. I can't figure out how to sort it though.
I can easily find how to do the sorting with Bound Columns - setting the 'SortExpression' property in the BoundColumn tag. But since I can't be positive on how many columns will be in the text file, I need to add the columns programmatically.
VB Code:
For Each ColumnName In ColumnNames objDC = New DataColumn(ColumnName, GetType(String)) objDT.Columns.Add(objDC) Next
But I can't find any way of setting the 'SortExpression' property this way, so when ever I click on a column header, it always errors out saying that it can't find the column name.
How do I do this?




Reply With Quote