Try to change your format in this way
griData.DefaultView.Sort = string.Format("[{0}] {1}", orderByField, sortDirection)
The usual way to treat column names that contains reserved characters is to enclose the name in square brackets.
EDIT I am unable to find a workaround for this case. (Of course it is a bad decision to have this kind of names, but honestly, I was convinced that the square brackets could handle that)
The only possibile workaround, found so far, is to change, in some way, your query, creating an alias for your column names and then you could sort for these alias. Something like this
SELECT Period,
[city1,state] AS City1State,
[city2,state] AS City2State,
[city3,state] AS City3State
FROM yourTable
....
orderByField = "City1State"
sortDirection = "DESC"
griData.DefaultView.Sort = string.Format("{0} {1}", orderByField, sortDirection)
EDIT AGAIN Your question has really hit my curiosity so I have searched the code used for the Sort property of a DataView and reached an internal method that seems to be the guilty one. It splits the sort string at the comma and it ignores altogether any square brackets put around the string. So, it seems that there is no way to use that name.
Code for the Sort property of the DataView.....
internal unsafe IndexField[] ParseSortString(string sortString)
{
string str;
int num;
int num2;
string[] strArray;
IndexField[] fieldArray;
DataColumn column;
bool flag;
char[] chArray;
fieldArray = zeroIndexField;
if (sortString == null)
{
goto Label_011A;
}
if (0 >= sortString.Length)
{
goto Label_011A;
}
// Here the split on the comma char (0x2C) ignoring the fact that
// the whole sort expression is inside square brackets????
strArray = sortString.Split(new char[] { 0x2c });
fieldArray = new IndexField[(int) strArray.Length];
num2 = 0;
goto Label_0111;
Label_0041:
str = strArray[num2].Trim();
num = str.Length;
flag = 0;
if (num < 5)
{
goto Label_007D;
}
if (string.Compare(str, num - 4, " ASC", 0, 4, 5) != null)
{
goto Label_007D;
}
str = str.Substring(0, num - 4).Trim();
goto Label_00A7;
Label_007D:
if (num < 6)
{
goto Label_00A7;
}
if (string.Compare(str, num - 5, " DESC", 0, 5, 5) != null)
{
goto Label_00A7;
}
flag = 1;
str = str.Substring(0, num - 5).Trim();
Label_00A7:
if (str.StartsWith("[", 4) == null)
{
goto Label_00DE;
}
if (str.EndsWith("]", 4) == null)
{
goto Label_00D5;
}
str = str.Substring(1, str.Length - 2);
goto Label_00DE;
Label_00D5:
throw ExceptionBuilder.InvalidSortString(strArray[num2]);
Label_00DE:
column = this.Columns[str];
if (column != null)
{
goto Label_00F7;
}
throw ExceptionBuilder.ColumnOutOfRange(str);
Label_00F7:
*(&(fieldArray[num2])) = new IndexField(column, flag);
num2 += 1;
Label_0111:
if (num2 < ((int) strArray.Length))
{
goto Label_0041;
}
Label_011A:
return fieldArray;
}