tags:

views:

112

answers:

1

I'm trying to convert some code that was written against the Telerik RadGrid control to work with the built-in GridView control.

This line gets the DataType of the column you're sorting on using the RadGrid control.

_sortBy.DataType = Grid.Columns.FindByDataField(e.SortExpression).DataType;

I'm trying to do the same thing using the standard .NET GridView Control.

How do you get the DataType of the column you're sorting on?

Thanks in advance.

A: 

You can try:

string sortedColumnName;
sortedColumnName = this.dataGridView1.SortedColumn.DataPropertyName;

Type sortedColumnType;
sortedColumnType = this.dataGridView1.Columns[sortedColumnName].ValueType;
João Angelo
I didn't specify but this is a web application. I can't use DataGridView but GridView which doesn't have SortedColumn. Thanks though.
TedH
I should have read the question with more attention...
João Angelo