Is there a way to have this drop down box sorted? I'm not able to google this one. Sorry for my noobness ![]()

-
-
I asked this question too last week but for ASP.NET instead of Windows Forms. It's hard to believe that they didn't build in a way for developers to specify that ordering when binding custom business objects!
-
If your data source is a dataset, you can use the 'Sort' property of the binding source (buildingAGBindingSource according to your screenshot) to the name of the property to sort by. It actually uses SQL syntax so you would set it to the string "Length" if you wanted sorting in ascending order or "Length desc" if you wanted length sorted in descending order.
I don't know what the binding source sort property does if you're not using datasets, I've never tried it.
Herbie -
I think we're talking about field ordering, not data ordering. The data sources use reflection to get the fields from the data source but choose a seemingly random order. However, interestingly enough, it uses the schema ordering when you use datasets, by using the ordering in the .XSD rather than reflection. I wish they had opened up that hook so we could specify field order.
I don't recall for BindingSource, but for ASP.NET ObjectDataSource, you have to specify the parameter indicating your sort order with the SortParameter property and then implement that property on your SelectMethod.
-
I 'm not talking about sorting the data. I would just appreciate it if the field list in the databinding dialogs would be sorted in alphabetical order or something.
I also assume that it just happens to be in the order that reflections spits out the properties. Which makes it painfull to use sometimes. -
Yet another example of the .NET GUI people not understanding UI. That's also why it took us 17 years to get a drop down combo that would incrementally look against the list, and limit to the list without having to type stuff really quickly or it would start from scratch again.
It's also why we still have a DateTimePicker control that still can't support null values right...
*sigh*
At least they fixed my bug for .NET 1.1 of the available dataset list to be sorted...
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.