J
Jen
I have used the code below in the past to sort a data grid column. Now I'm
using a SqlCeResultSet as my DataSource for the grid.
Since the SqlCeResultSet is new to me I was hoping someone could point out
what needs to be converted to support using a resultset instead of a
DataTable.
Thanks!
// Sort grid by column
void SortGrid(int col)
{
if (this.DataSource is DataTable)
this.DataSource = (this.DataSource as
DataTable).DefaultView;
DataView vw = (DataView)this.DataSource;
string sort = vw.Table.Columns[col].ColumnName;
if (vw.Sort.StartsWith(sort))
{
if (vw.Sort.EndsWith("ASC"))
vw.Sort = sort + " DESC";
else
vw.Sort = sort + " ASC";
}
else
{
vw.Sort = sort + " ASC";
}
}
using a SqlCeResultSet as my DataSource for the grid.
Since the SqlCeResultSet is new to me I was hoping someone could point out
what needs to be converted to support using a resultset instead of a
DataTable.
Thanks!
// Sort grid by column
void SortGrid(int col)
{
if (this.DataSource is DataTable)
this.DataSource = (this.DataSource as
DataTable).DefaultView;
DataView vw = (DataView)this.DataSource;
string sort = vw.Table.Columns[col].ColumnName;
if (vw.Sort.StartsWith(sort))
{
if (vw.Sort.EndsWith("ASC"))
vw.Sort = sort + " DESC";
else
vw.Sort = sort + " ASC";
}
else
{
vw.Sort = sort + " ASC";
}
}