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.
Unfortunately, activation email could not send to your email. Please try again.

Show triangle sort on first appearance of Databoundgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

30044 Jun 9,2005 11:37 AM Jun 15,2005 11:25 AM Windows Forms 4
loading
Tags: GridControl
Sebastien Giroux
Asked On June 9, 2005 11:37 AM

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 01: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

Sebastien Giroux
Replied On June 10, 2005 03:12 PM

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 07: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.

Sebastien Giroux
Replied On June 15, 2005 11:25 AM

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

CONFIRMATION

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.

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.

;