.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 29th, 2012, 05:46 AM
anziga anziga is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 189 anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level)anziga User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 43 m 32 sec
Reputation Power: 327
Sorting multiple datagridview columns

I want to sort multiple datagridview columns programmatically, I used following code...
Code:
Me.DataGridView1.Sort(IDDataGridViewTextBoxColumn, ComponentModel.ListSortDirection.Ascending)
Me.DataGridView1.Sort(CodeDataGridViewTextBoxColumn, ComponentModel.ListSortDirection.Ascending)
Me.DataGridView1.Sort(BlnoDataGridViewTextBoxColumn, ComponentModel.ListSortDirection.Ascending)
but it doesn't quite work, one of the column looses its order. Is there a way to force multiple columns to certain order and/or set one or more columns more dominant?

Reply With Quote
  #2  
Old September 21st, 2012, 01:47 AM
diyaots diyaots is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 121 diyaots Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 53 m 21 sec
Reputation Power: 0
Sorting multiple datagridview columns

Hi
Find the reply of your question...

If your DataGridView is databound, you can sort your Datatable view and rebind to datagridview as below (Code in C#):

DataView view = Datatable.DefaultView;
view.Sort = "ID ASC, status DESC";
dataGridView.DataSource = view; //rebind the data source

Thanks & Regards
Diya

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Sorting multiple datagridview columns

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap