We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Show triangle sort on first appearance of Databoundgrid

Thread ID:





30044 Jun 9,2005 03:37 PM UTC Jun 15,2005 03:25 PM UTC WinForms 4
Tags: GridControl
Sebastien Giroux
Asked On June 9, 2005 03:37 PM UTC

Hi, Actually, it is possible to see the sort triangle in the header of the databoundgrid only after you have clicked on it. Is there any way to show it the first time it appears? Do I have to sort it in the code on form load to see it? Thanks a lot, Sebastien

Administrator [Syncfusion]
Replied On June 9, 2005 05:24 PM UTC

Yes, you would have to sort the datasource before the grid is shown to initially see the sorted grid. You can do this in form.load (after the grid''s DataSource has been set). If you know the DataView associated with teh datasource, you can directly set dataView1.Sort = "MyColumn" to sort MyColumn. If you do not have knowledge of teh dataview, you can get it from the BindingContext. CurrencyManager cm = (CurrencyManager) grid.BindingContext[grid.DataSource, grid.DataMember]; DataView dv = (DataView) cm.List; dv.Sort = "MyColumn"; CurrencyManager

Sebastien Giroux
Replied On June 10, 2005 07:12 PM UTC

Thanks, I''ve used the grid.defaultView.Sort method. Can I decide of the sort type? (Ascending or descending) Thanks! Sebastien

Administrator [Syncfusion]
Replied On June 10, 2005 11:11 PM UTC

If your grid has already been sorted, you can test grid.defaultView.Sort. If the grid was sorted descending, grid.defaultView.Sort will in in DESC. If it does not end in DESC, the grid was sorted ascending.

Sebastien Giroux
Replied On June 15, 2005 03:25 PM UTC

I did this on the panel load: m_logsDataTable.DefaultView.Sort = "[Time]DESC"; and it worked. Thanks! Sebastien


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon