You can programmatically alter a GridView.
bool addSort = true;
BoundField currentBF = new BoundField();
currentBF.DataField = "LastName";
currentBF.HeaderText = "Employee Last Name";
if (addSort)
{
currentBF.SortExpression = "LastName";
}
gv.Columns.Add(currentBF);
Be careful with the postback .
"Terry Olsen" <to******@hotmail.comwrote in message
news:uE**************@TK2MSFTNGP06.phx.gbl...
When I let the GridView automatically generate columns, I can allow
sorting. But when I turn autogenerate columns off, it won't allow
sorting (column names are not hyperlinks).
Is there a way I can turn sorting on when i'm not autogenerating
columns?
*** Sent via Developersdex http://www.developersdex.com ***