{
IList
if (IsPilot)
tl = TService.GetPilotTestList();
else
tl = TService.GetOperationalTestList();
if (tl != null)
{
var param = Expression.Parameter(typeof(tblTest), e.SortExpression);
var sortExpression = Expression.Lambda < Func < tblTest, object>>(Expression.Convert(Expression.Property(param, e.SortExpression), typeof(object)), param);
// If we're toggling sort on the same column, we simply toggle the direction. Otherwise, ASC it is.
// e.SortDirection is useless and unreliable (only works with SQL data source).
if (_sortBy == e.SortExpression)
_sortDirection = _sortDirection == SortDirection.Descending ? SortDirection.Ascending : SortDirection.Descending;
else
_sortDirection = SortDirection.Ascending;
_sortBy = e.SortExpression;
if (_sortDirection == SortDirection.Ascending)
{
clbgvTestForms.DataSource = tl.AsQueryable
}
else
{
clbgvTestForms.DataSource = tl.AsQueryable
}
clbgvTestForms.DataBind();
}
}
_sortBy and _sortDirection are parameters which value is saved in viewstate.
没有评论:
发表评论