473,804 Members | 3,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remembering Sort Order on WinForms DataGrid

Hello,

Is it possible to retrieve and set the sort order for a DataGrid
control on a WinForm? I had a user request this functionality, and I
can't seem to find a place to set and retrieve it from. Am I missing
something, or is this something that is more difficult to do than is
worth the time?

Thanks in advance!

Joseph

Mar 30 '06 #1
2 1560
Joseph,

Your surely miss something because it is easy to do.

For that is the DataView or the DefaultView. Which is a view on a datatable.
In that DataView or Defaultview there is a property Sort. You can set that
while you can get the current value if a user changes that by clicking at
the top of the grid.

myDataTable.Def aultview.Sort = "MySecondColumn "

I hope this helps,

Cor

"Joseph Ferris" <jo***********@ gmail.com> schreef in bericht
news:11******** **************@ t31g2000cwb.goo glegroups.com.. .
Hello,

Is it possible to retrieve and set the sort order for a DataGrid
control on a WinForm? I had a user request this functionality, and I
can't seem to find a place to set and retrieve it from. Am I missing
something, or is this something that is more difficult to do than is
worth the time?

Thanks in advance!

Joseph

Mar 31 '06 #2
Cor,

Yep. Missed the obvious. I knew that if I stepped away from it and
asked, it would save me a lot of aggrevation in the long run.

Thank you for helping me conserve what little hair I have left!

Joseph

Mar 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1502
by: Martin Clark | last post by:
Hi, I have a C# Windows .net application (not asp.net) which uses a datagrid to display information. The datagrid is populated from a DataView, in which I specify a sort order ("ORDER BY CreateDate DESC"). The user of the application is able to then resort the data by clicking on any of the datagrid column headings. What I can't work out how to do, is to detect what new sort order the user might have selected, i.e. what the
0
1850
by: Tom Hughes | last post by:
I want to change one field of all selected rows to a provided value. Problem 1 I am using the Binding Manager Base to bind the datagrid to the appropriate dataTable as recommended by KB817247. It works in all cases but one. If the field being changed is also one the user has selected as a sort column, then all but the first selections are missed. If I remove the sort from that column before or after
5
4444
by: Bill Todd | last post by:
In a WinForms application with a DataGrid bound to a DataTable, if I change the DefaultDataView.Sort property the order of the data in the grid does not change. If I change the Sort property then reassign the DataTable to the DataGrid's DataSource the DataGrid does show the new order. If I change the Sort property then call DataGrid.SetDataBinding the DataGrid does _not_ show the new order.
7
2478
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here
1
1459
by: Hrvoje Vrbanc | last post by:
Hello all! I would be grateful if someone could offer me some help with the following problem: I have a DataGrid control with sort enabled. Therefore it could be sorted in several different ways. The same datagrid also have a Button Column with Update button. After the update action for any particular item is completed, my update method calls FillDataGrid(sort_parameter) function to refresh the DataGrid content. But...how could my...
5
1445
by: Kurt Schroeder | last post by:
I'm using VS.net. I have created a component with the basic set of database commands. This component returns a record set that is bound to a datagrid. I want to add a dynamic sort, but am not sure how to do this. If the query were on the same webform this would not be a problem, i'd jist add it to the select string. but..... using the component designer in vs.net i'm not sure how to do this, nor am i sure how to call the fill with the sort...
1
1261
by: Jean-Claude Bertrand | last post by:
Hi! Windows of the application IO have to built (my first one in vb.Net) is made from 2 part: a) A grid wich will be used only to display the main information of the current record (so the grid must select the entire row and not allow editing). I have selected the datagrid so far and succed after many research to allow only entire row selection with this help http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q792q
3
1686
by: Marco | last post by:
Hi, I'm new to datagrids and was hopping to get some help. I tried to bind an arraylist to a datagrid but the columns seem to be displayed in a random order for some reason. Is there someway that I can specify what order they should be in and also give them new names? Also is there someway to hide certain columns from the datagrid at all? Thanks.
0
1438
by: Reddy4All | last post by:
Hi- Is there any possiblity to make Datagrid control (Winforms) column header sort arrow more prominent in .net 2003. In Windows forms Datagrid control, when user click on the column header, default sort arrow will appear but i want to replace it by another image or bitmap file. Is there any possiblity or any methods to override, so that we can place different arrow or image on the datagrid contol column header sort arrow look more prominent? ...
0
9584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.