473,545 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid sort order

i have a win form w/ a datagrid inside
while the app is running many instances of this form r created and closed
how can i ensure that the sort user used last time is kept until the whole
app is
closed

TIA
Nov 20 '05 #1
4 3673
John:

Here's my answer from the WindowsForms ng
Create a DataView as a static property and bind everything to it. If you
need seperate datasources with the same sort order, same thing... static
class storing the Index of the column you want sorted on . Every time you
bind the grid, set the sort order (ideally of a dataview) to that
columnindex.

If you are in VB.NET, you can just use modules if you are uncomfortable with
Static properties, they are quite similar.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
"John Smith" <a_*@abv.bg> wrote in message
news:#R******** ******@TK2MSFTN GP12.phx.gbl...
i have a win form w/ a datagrid inside
while the app is running many instances of this form r created and closed
how can i ensure that the sort user used last time is kept until the whole
app is
closed

TIA

Nov 20 '05 #2
Hi John,

When you create a dataview you can save the last sortorder as
\\\
Dim sortcolumnAndOr der As String = dv.Sort
////
However only the last column that is clicked not multiple columns.

I hope this helps?

Cor
Nov 20 '05 #3
tnx, ill try - but its not too simple :((
"William Ryan eMVP" <do********@com cast.nospam.net > wrote in message
news:O6******** ******@TK2MSFTN GP09.phx.gbl...
John:

Here's my answer from the WindowsForms ng
Create a DataView as a static property and bind everything to it. If you
need seperate datasources with the same sort order, same thing... static
class storing the Index of the column you want sorted on . Every time you
bind the grid, set the sort order (ideally of a dataview) to that
columnindex.

If you are in VB.NET, you can just use modules if you are uncomfortable with Static properties, they are quite similar.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
"John Smith" <a_*@abv.bg> wrote in message
news:#R******** ******@TK2MSFTN GP12.phx.gbl...
i have a win form w/ a datagrid inside
while the app is running many instances of this form r created and closed how can i ensure that the sort user used last time is kept until the whole app is
closed

TIA


Nov 20 '05 #4
i`ll try this too

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:Oq******** ******@tk2msftn gp13.phx.gbl...
Hi John,

When you create a dataview you can save the last sortorder as
\\\
Dim sortcolumnAndOr der As String = dv.Sort
////
However only the last column that is clicked not multiple columns.

I hope this helps?

Cor

Nov 20 '05 #5

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

Similar topics

0
1490
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...
5
4433
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...
1
1320
by: Maqsood Ahmed | last post by:
Hello! There is a DataGrid on a form that is populated through DataTable and filters have been applied to through DataView. The DataTable gets updated through some events and obviously it also reflects at the datagrid. Now problem arises, that whenever a new record is being inserted in the datagrid, It scrolls waywardly, that distracts the...
2
1854
by: Snig | last post by:
Hi, I want to sort the DataGrid according to the number of clicks of mouse on the column-header link. e.g. if user clicks on the header once - it will be sorted ASC if the header is double-clicked - it will be sorted DESC It is not exactly toggling the sorting-order. I have seen a lot of messages and articles in the web about toggling...
2
2230
by: enak | last post by:
I can not get my datagrid to page. I have a datagrid that I can sort 2 of the columns. This works great. I added paging and when I display the dg it shows 5 pages. (I am showing page numbers at the bottom of the dg.) When I click on the pages nothing happens until I get to the last page. Then and only then is the last page displayed. If I...
7
2431
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
1451
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...
5
1434
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...
0
1826
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then assign the datatable.dataview to my datagrid.datasource member so it will display my results.. I need to give the user an option to change the order...
0
1327
by: rn5a | last post by:
A DataGrid control displays records from a SQL Server 2005 DB table. The AllowSorting property of the DataGrid has been set to True & the SortExpressions of the BoundColumns have been set to the different columns so that users can sort the DataGrid by clicking the headers in the DataGrid. The DataGrid can be sorted using all the headers in the...
0
7467
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
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...
0
7807
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...
1
7419
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5326
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...
0
4944
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...
0
3450
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...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.