473,803 Members | 4,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid, how to determine which column is being sorted on

Hi,

I've a DataGrid and a DataSet (not a DataView) as the DataSource.
Users can click on column headers and sort the contents of the DataGrid.
I want to know how to determine which column is being used to order the sorted data.
I can't see in the microsoft DataGrid in vb.net the Event 'SortCommand'.
I think that its because I'm using vb.net not asp.

Thanks in advance.
Nov 20 '05 #1
3 3769
Hi Paul,

Everything you wanted to know about the datagrid.
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

When it is not there it will be hard to find.

I hope this helps?

Cor

I've a DataGrid and a DataSet (not a DataView) as the DataSource.
Users can click on column headers and sort the contents of the DataGrid.
I want to know how to determine which column is being used to order the sorted data. I can't see in the microsoft DataGrid in vb.net the Event 'SortCommand'.
I think that its because I'm using vb.net not asp.

Nov 20 '05 #2
I have the same quesiton and this was the first place I looked. I see using
the bindingmanagerb ase to do this, but I don't know where to put this. What
event is it when the user sorts? I want this to fire automatically after
the sort occurs, but I'm not sure where to stick the code that is on this
link to reference that row.

Thanks,
Ben

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi Paul,

Everything you wanted to know about the datagrid.
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

When it is not there it will be hard to find.

I hope this helps?

Cor

I've a DataGrid and a DataSet (not a DataView) as the DataSource.
Users can click on column headers and sort the contents of the DataGrid.
I want to know how to determine which column is being used to order the

sorted data.
I can't see in the microsoft DataGrid in vb.net the Event 'SortCommand'.
I think that its because I'm using vb.net not asp.


Nov 20 '05 #3
Hi,

There isn't a sort event. On the mousedown event for the datagrid
check and see if the person clicked on a columnheader.

http://www.onteorasoftware.com/downl...redcolumns.zip

Ken
----------------------

"Becker" <be*@benbecker. net> wrote in message
news:#E******** *****@TK2MSFTNG P11.phx.gbl:
I have the same quesiton and this was the first place I looked. I see
using
the bindingmanagerb ase to do this, but I don't know where to put this.
What
event is it when the user sorts? I want this to fire automatically after

the sort occurs, but I'm not sure where to stick the code that is on this

link to reference that row.

Thanks,
Ben

"Cor Ligthert" <HYPERLINK
"mailto:no***** *****@planet.nl "no**********@p lanet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi Paul,

Everything you wanted to know about the datagrid.
HYPERLINK
"http://www.syncfusion. com/FAQ/WinForms/FAQ_c44c.asp"ht tp://www.syncfusion. c
om/FAQ/WinForms/FAQ_c44c.asp

When it is not there it will be hard to find.

I hope this helps?

Cor


I've a DataGrid and a DataSet (not a DataView) as the DataSource.
Users can click on column headers and sort the contents of the
DataGrid.
I want to know how to determine which column is being used to order
the
sorted data.

I can't see in the microsoft DataGrid in vb.net the Event
'SortCommand'.
I think that its because I'm using vb.net not asp.



--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004
Nov 20 '05 #4

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

Similar topics

3
4846
by: Oliver Drobnik | last post by:
Hi, I have a datagrid bound to a datatable. Now if I sort the datagrid by clicking on one of the column heads I can no longer use the index in the datagrid to find the corresponding row in the datagrid. How can I find out the new (sorted) index if I know the row in the datatable? kind regards
8
1311
by: pcPirate | last post by:
Hi, I've followed some advice through this forum in which I would change the dataset value in order to change the particular cell value in datagrid via coding. What I'm doing now is that, if I change the first column, the second column in the same row would display the same input as the first's. The way I did is to take the row no. of the column edited and update the dataset in the same row, second column. However, the datagrid actually...
1
1730
by: Das | last post by:
Hi, I'm using c# windows application & set the allowsort property to true. I wanted to know. when user clicks the header of any column the data is sorted by that column. How can I know which is the last sorted field..... I want to retrieve the currently selected row after the sort....
5
1822
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value of the item selected by the user? That is, not the datagrid index 'location' of the item the user selected, but the value inside a column of this item the user clicked on. I would use the CurrencyManager in a windows application but I'm not...
13
2500
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for them. In a plain vanilla DataGrid, when you click on the RowHeader, the appropriate row changes colors. I ASSUME this should be done in the Paint (or PaintText) override of the DataGridColumnStyle in question. My problem is that I don't know...
10
4957
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than the column order of the datatable). I also allow the user to click on a column header to sort the datagrid by that column. I need to identify the row and column in the datatable when the user clicks on a cell in the datagrid. Using the...
0
1339
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 DataGrid except for the first column header. <asp:DataGrid ID="dg1" AllowSorting="true"...
1
7146
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on the first column in the grid only. I havent found a way to reliably do this yet. I tried putting the following code in the datagrid's mouse down event Dim hti As DataGrid.HitTestInfo
3
7383
by: rn5a | last post by:
A DataGrid has the following TemplateColumn: <asp:DataGrid ID="dgCart"...OnSortCommand="SortGrid" AllowSorting="true"....> <Column> <asp:TemplateColumn HeaderImageUrl="Images\Up.gif" HeaderText="ID" SortExpression="PID"> <ItemTemplate> <asp:Label ID="lblPID" Text=<%# Container.DataItem("PID") %> runat="server"/>
0
9703
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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
10548
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...
1
10295
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
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...
0
6842
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
5500
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...
3
2970
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.