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. Image for the cookie policy date

Show triangle sort on first appearance of Databoundgrid

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

4 Replies

AD Administrator Syncfusion Team 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

SG Sebastien Giroux 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

AD Administrator Syncfusion Team 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.

SG Sebastien Giroux 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

Live Chat Icon For mobile
Up arrow icon