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

filterbar combobox sorting

Thread ID:





21333 Nov 8,2004 08:27 AM UTC Nov 8,2004 09:10 AM UTC WinForms 1
Tags: GridControl
Asked On November 8, 2004 08:27 AM UTC

Hi, I have a gridDataBoundGrid wired to a gridFilterBar. To ensure that the comboboxes on the filterbar are sorted when clicked on, I have the following code: for(int i = 0; i < grid.Model.ColCount; i++) { DataTable dt = grid[1, i].DataSource as DataTable; if(dt != null) { string sortString = dt.Columns[0].ColumnName + " ASC"; dt.DefaultView.Sort = sortString; } } The reason I need this code is because as rows are being added/deleted from the grid I update the filterbar combobox models are described in: http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=19224 This works fine as long as the DataType for the columns these comboboxes are being used on are strings. I have some columns that are ints but when the values are added to the combobox model they are being added as strings and then the combo box is not sorted numerically. I can''t change the dataType as the (none) value needs to be displayed. Is there anyway I can get the combobox to sort numerically? Regards, Matt

Administrator [Syncfusion]
Replied On November 8, 2004 09:10 AM UTC

I do not know of a simple way to do this. One possibilty is to add an extra column of typeof(int) to the combobox datatable. Then move the ints from your ''real'' column to this extra column. For the (none) and (custom) entires add some well-chosen int values that will put them in the correct places in your int sort order. Then sort the DataTable based on this extra hidden column.


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon