Thank you for your answers on the sorting. I turned to LINQ to help sort dynamically. Since the grid knows whether to sort ASC or DESC, and which field, I used a LINQ Expression. The Expression performed the sorting, and then I simply bound those results to my gridview.
I suspect the jQuery method would be faster, and wouldn't require a full postback.
using System.Linq.Expressions;
protected void gridView_Sorting(object sender, GridViewSortEventArgs e)
{
//re-run the query, use linq to sort the objects based on the arg.
//perform a search using the constraints given
//you could have this saved in Session, rather than requerying your datastore
List<T> myGridResults = PerfomSearch();
if (myGridResults != null)
{
var param = Expression.Parameter(typeof(T), e.SortExpression);
var sortExpression = Expression.Lambda<Func<T, object>>(Expression.Convert(Expression.Property(param, e.SortExpression), typeof(object)), param);
if (e.SortDirection == SortDirection.Ascending)
{
myGridView.DataSource = myGridResults.AsQueryable<T>().OrderBy(sortExpression);
}
else
{
myGridView.DataSource = myGridResults.AsQueryable<T>().OrderByDescending(sortExpression);
};
myGridView.DataBind();
}
}