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

filterbar combobox sorting

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

1 Reply

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

Live Chat Icon For mobile
Up arrow icon