473,546 Members | 2,289 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 4198
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
3842
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) ...
3
75013
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
94226
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
29650
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
3181
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
1330
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
2993
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...
9
3883
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
2839
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
7694
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. ...
0
7947
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
7461
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...
0
6026
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...
1
5360
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
5080
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
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
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...

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.