DataView sort does not show in DataGrid

B

Bill Todd

I have a DataTable in a DataSet. A DataGrid is bound to the DataTable.
When I assign a field to the DataTable.DefaultView.Sort property the
order in the DataGrid does not change.

What am I missing?
 
W

William Ryan eMVP

Todd:

The DefaultView will send the sort back to its original state, so if you
haven't reset it, then it's not going to do anything. Just to test, call
..Sort on another field, anyone will do just to verify that it's working. If
you've already called so, then let me know.

Cheers,

bill
 
P

Peter Huang

Hi Bill,

I reviewed the thread, and find that you have posted a similar problem inn
the same newsgroup.
Subject: Why must I rebind DataGrid to see Sort?
Newsgroups: microsoft.public.dotnet.languages.csharp

You may go and have a check, if you still have any concern on this issue,
please post there and I will follow up in that thread.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

William Ryan eMVP

Bill:

I just read your top post.. You are binding to the DataTable... Create a
DataView and bind to it instead. The View's sort has No effect on the
datatable's positioning, so if the grid is bound to it, it won't do
anything. Bind to the view instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top