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 12:24 PM

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 02:12 PM

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 06:11 PM

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 10:25 AM

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

Loader.
Live Chat Icon For mobile
Up arrow icon