Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
905
How do I define the default sort column?
posted

In a WebDataGrid, how to I define the default Sort column? (Visually, in a property.)

  • 21382
    posted
    I don't believe you can set a sort order at design time, but it can be done at run time by adding a column to the sorted columns collection. this.WebDataGrid1.Behaviors.Sorting.SortedColumns.Add(this.WebDataGrid1.Columns[0], Infragistics.Web.UI.SortDirection.Descending);
  • 28464
    posted

    I am not sure there is a default sort column - sorting occurs automatically on clicking the header of a column. Do you need to have the data in the grid sorted by a particular columns before that? If this is the case, I believe the easiest approach is if you directly modify your datasource to include ORDER BY [ColumnName} ASC in the SQL Select clause and then bind this datasource to the grid.