How do i set a defult sort column

Can i set a column so that on load of the model it sets that column as to sorted.

Thanks

1 Reply

GK Ganesan K Syncfusion Team September 14, 2009 05:15 AM UTC

Hi Andrew,

Thanks for using Syncfusion products.

You can listen the Model_Initialized event and set the column to be sorted as below,

dataGrid.Model.Initialized += new EventHandler(Model_Initialized);

void Model_Initialized(object sender, EventArgs e)
{
var sortColumn = new GridDataSortColumn()
{
ColumnName = "OrderID",
SortDirection = ListSortDirection.Ascending
};
dataGrid.Model.TableProperties.SortColumns.Add(sortColumn);
}


Please let me know if you need any more details.

Thanks
Ganesan

Loader.
Up arrow icon