Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Windows forms sort using dataviews
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01338204
Message ID:
01340917
Views:
16
Kevin,

Either I misunderstand the answer or I have not asked the question carefully. The automatic sort is occurring. What I want is to override some of the automatic sorts. For example, when they click on the last name column, I want the DataView ordered by lastname + firstname + middlename. I created a DataView for this. What I'm not sure about is the best way to change the views.

Currently, the binding source is set to the business object, in this case Patient. The BindingSourceMember is set to Patient.DefaultView. When I click on the column header for lastname, it orders the data by last name only. What I want to have happen is to order the data using my view for lastname. I notice that in the grid column collection, there is a behavior property for sortmode to make it programmatic. I'm guessing that I need to use this and somewhere capture the click on the column header and substitute my desired behavior for the standard behavior but I'm not exactly sure how to do that. The DataGridView for the web has a property for SortExpression but I don't see anything equivalent to that for Windows Forms. What is the recommended practice for this?

Thanks.

>Linda,
>
>>I have a Windows form with an mmDataGridView object. I managed to get the DefaultView to work but I'm not sure what to do about changing the sort orders. I would like to keep the functionality of letting the users click on the header of the column but, as an example, when they click on the header of the Last Name, I would like the sort to use my DataView ordered by lastname, firstname and middlename. Do I need to trap this in the gridview's sorting event and set the DataView there?
>
>If you are binding using a DataView, the sort should automatically occur when you click the column header. How are you specifying the BindingSource?
>
>Best Regards,
Linda Harmes
HiBit Technologies, Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform