473,898 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sort DataGridView on unbound column issue...

Hi group,

I have a DataGridView that is mainly consisting of data bound columns.
One column however is unbound. I'm not able to sort the grid on this
column! Is that normal behaviour? If so, what are my options?

Thanks (again) for your time,
Frederik
Feb 15 '08 #1
3 4216
Yes, it is normal behavior. If the column is not databound, it doesn't know
the underlying data source to handle the sorting.

If you are using datasets or data tables, you could add a column to your
dataset.

Otherwise, you can try handling the sort stuff yourself. You could try
capturing the column header click event, check to see what column it is, and
sort it yourself.

I just created a dgv bound to a BindingList<myO bj>, and found excellent
examples for handling the sorting in Brian Noyes' Data Binding book.

RobinS.
GoldMail, Inc.
----------------------------------
"Frederik" <fr********@gma il.comwrote in message
news:17******** *************** ***********@e23 g2000prf.google groups.com...
Hi group,

I have a DataGridView that is mainly consisting of data bound columns.
One column however is unbound. I'm not able to sort the grid on this
column! Is that normal behaviour? If so, what are my options?

Thanks (again) for your time,
Frederik
Feb 16 '08 #2
Otherwise, you can try handling the sort stuff yourself. You could try
capturing the column header click event, check to see what column it is,
and sort it yourself.
How to capture mouse click in grid column header ?
Grid OnMouseClick not not have such flag.

Andrus.
Feb 18 '08 #3
Capture the ColumnHeaderMou seClick event.

Or capture the CellClick event, and check the rowindex in the
DataGridViewCel lEventArgs. If it's -1, they clicked on the header.

RobinS.
GoldMail, Inc.
-------------------------------
"Andrus" <ko********@hot .eewrote in message
news:OA******** ******@TK2MSFTN GP02.phx.gbl...
>Otherwise, you can try handling the sort stuff yourself. You could try
capturing the column header click event, check to see what column it is,
and sort it yourself.

How to capture mouse click in grid column header ?
Grid OnMouseClick not not have such flag.

Andrus.

Feb 23 '08 #4

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

Similar topics

2
3885
by: Todd | last post by:
Hi. I want to sort the records on my form (using either a continuous form or a datasheet) by the unbound "description" column in a combo box on the form (or in the datasheet.) Here's a rough text representation of what I'm talking about FORM Item Number Description Category (text box) (text box) (combo box - 2 columns)
3
75081
by: David Veeneman | last post by:
I'm trying to set images in a bound DataGridView image column. My enum has three possible values, and I have an image that I want to show for each value: EnumValue.OK --GreenLight.gif EnumValue.Caution --YellowLight.gif EnumValue.Violation --RedLight.gif I want to display the graphic, instead of the enum value, in each row of the grid.
3
94296
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my database. For example: table JobTypes 1 | Manager 2 | Controller 3 | Supervisor table Employee
2
29669
by: tee | last post by:
Hi, How do i sort datagridview programmically, current i have the following code but i keep get the error saying "DataGridView control must be bound to an IBindingList object to be sorted.", What is IBindingList and how would i go about using it. Here are my code private void dataGridView1_ColumnHeaderMouseClick(object sender,
4
3195
by: =?Utf-8?B?am9obmI=?= | last post by:
Hi All I have a 2005vb.net Form with 2 datagrids with a perent child relationship. On the child datagrid I have 2 unbound columns which are derived from other columns in the grid. And it works fine. The question: how do I sub total an unbound calculated column in the child datagrid and get to recalculate for each perent record? TIA johnb
3
1344
by: frenzy99 | last post by:
Can some one help me with this problem. I want to sort DataGridView based on the order in which values were added, not on the basis of any particular column, unlike the functionality provided by DataGridView.Sort()
4
3019
by: ahd2008 | last post by:
Hi, I've a query on a tabular form the represents the cureent status of the availabe seats of each course. I added unbound column(Status) to the form that supposed to say either close when the number of the availabe seats is =0 or open when the number of the avaialbe seats is >0. Can this be applied on tabular forms? If not is there substitute approach?
9
3905
by: munkee | last post by:
All, I am using the following adapted code to export a filtered recordset from a search form in to excel: Option Explicit Private Sub btnexcelexport_Click() 'revised for late binding 'define variables Dim xlApp As Object
0
2867
by: visweswaran2830 | last post by:
Hi, I am having datagridview in that I have datagridview combobox column and noraml textfield. I want to know that how can I load selected value in that combox box when I am loading all entered details in data grid view.
0
9993
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
11254
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
10854
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...
1
10946
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,...
1
8034
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
7187
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
5876
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
6076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3303
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.