12-15-2009 02:49 PM
I've used the following code to sort a datagrid (set a default sort) on the Load Actions of a form by adding a Code Snippet Action Item
namespace Sage.BusinessRules.CodeSnippets
{
public static partial class AccountJobsEventHandlers
{
public static void SortDataGrid( IAccountJobs form, EventArgs args)
{
System.Web.UI.WebControls.GridView grid = (System.Web.UI.WebControls.GridView)form.grdVACCOUNTJOBSS.NativeControl;
grid.Sort("JOBSTATUS", System.Web.UI.WebControls.SortDirection.Ascending);
}
}
}
It works well when you only need one default sort. Is there a way to add multiple sorting to a datagrid? I want to sort by JOBSTATUS asc, JOBTYPE desc, and DATE asc. I thought I could just add call to grid.Sort for all three, but it doesn't seem to work that way (it just sorts by the last grid.Sort call). Has anyone figured out a way to do this?