473,388 Members | 1,153 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

datagridview control easy filtering ?

I'm trying to set my datagridview so that the first row will be left blank
and to use it as a filtering filed for the datagridview. Until now I was
using 2 datagridview the upper one with a header that sort and one row for
filtering and the lower one with no header for the data. Only it is very
complicated to work this way cause for example when the user click on sort
on the upper datagridview I need to sort the lower grid and so on when the
user change the size of column on the upper datagridview I need to change
the lower one accordingly. Any advice on how to do this ??
Nov 17 '05 #1
10 13318
Hi Milk-jam,

Welcome to MSDN newsgroup.
Regarding on the displaying additional filter row in DataGridView/DataGrid
question, we'll have a look and do some research and will update you as
soon as possible. Thanks for your understanding.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "milk-jam" <mi******@newsgroups.nospam>
| Subject: datagridview control easy filtering ?
| Date: Sat, 27 Aug 2005 12:48:28 +0200
| Lines: 10
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#t*************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: hfa62-0-138-26.bb.netvision.net.il 62.0.138.26
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.languages.csharp:118718
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I'm trying to set my datagridview so that the first row will be left
blank
| and to use it as a filtering filed for the datagridview. Until now I was
| using 2 datagridview the upper one with a header that sort and one row
for
| filtering and the lower one with no header for the data. Only it is very
| complicated to work this way cause for example when the user click on
sort
| on the upper datagridview I need to sort the lower grid and so on when
the
| user change the size of column on the upper datagridview I need to change
| the lower one accordingly. Any advice on how to do this ??
|
|
|

Nov 17 '05 #2
Hi milk-jam,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to sort the lower datagridview
control according the the upper one's sort. If there is any
misunderstanding, please feel free to let me know.

In this case, you can try to handle the DataGridView.Sorted event. In this
event, you can get the sorted column using DataGridView.SortedColumn, and
then set the lower DataGridView's sorted column accordingly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #3
Nop, thats not what im trying to achive at all, thats what im doing at the
moment.
What im trying to achive is to use 1 datagridview and to skip the first row
when i populate the datagridview and i wanna use the first row for
filtering. because i couldnot find the way to do it i used 2 datagridview
but my solution complicate evrything and i wanna find a way to do it with 1
datagridview.

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:ir*************@TK2MSFTNGXA01.phx.gbl...
Hi milk-jam,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to sort the lower
datagridview
control according the the upper one's sort. If there is any
misunderstanding, please feel free to let me know.

In this case, you can try to handle the DataGridView.Sorted event. In this
event, you can get the sorted column using DataGridView.SortedColumn, and
then set the lower DataGridView's sorted column accordingly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #4
Hi milk-jam,

Do you mean that you need to change the header row of DataGridView to a
filter that can filter the data in the column just like turning Filter on
in Excel?

If so, you have to subclass the DataGridView class and add ComboBoxes to
the header row. When a user selects from this ComboBox, set the rowfilter
property of the DataView. There is no specific code sample for this, but
you can check the following sample for reference.

http://www.codeproject.com/cs/miscct...ridColumns.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #5
Hi milk-jam,

Do you mean that you need to change the header row of DataGridView to a
filter that can filter the data in the column just like turning Filter on
in Excel?

If so, you have to subclass the DataGridView class and add ComboBoxes to
the header row. When a user selects from this ComboBox, set the rowfilter
property of the DataView. There is no specific code sample for this, but
you can check the following sample for reference.

http://www.codeproject.com/cs/miscct...ridColumns.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #6
Yes thatís what I'm trying to do

But I donít understand how to do it ?

How to I add a ComboBoxes to the header row

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:H6**************@TK2MSFTNGXA01.phx.gbl...
Hi milk-jam,

Do you mean that you need to change the header row of DataGridView to a
filter that can filter the data in the column just like turning Filter on
in Excel?

If so, you have to subclass the DataGridView class and add ComboBoxes to
the header row. When a user selects from this ComboBox, set the rowfilter
property of the DataView. There is no specific code sample for this, but
you can check the following sample for reference.

http://www.codeproject.com/cs/miscct...ridColumns.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #7
Yes thatís what I'm trying to do

But I donít understand how to do it ?

How to I add a ComboBoxes to the header row

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:H6**************@TK2MSFTNGXA01.phx.gbl...
Hi milk-jam,

Do you mean that you need to change the header row of DataGridView to a
filter that can filter the data in the column just like turning Filter on
in Excel?

If so, you have to subclass the DataGridView class and add ComboBoxes to
the header row. When a user selects from this ComboBox, set the rowfilter
property of the DataView. There is no specific code sample for this, but
you can check the following sample for reference.

http://www.codeproject.com/cs/miscct...ridColumns.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #8
Hi milk-jam,

Sorry, but with my further research, I found that the header row of the
DataGridView is highly encapsuled. So I don't suggest you to do this. You
can try to add ComboBoxes above the DataGridView to achieve this.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #9
I think my 2 datagridview solution is easier to work with than using
ComboBoxes above the header.
Lets say the user drag column1 and drop it after column 4, will be easier to
triger the same even in the second datagridview than to try and replace the
ComboBoxes location. But im sure there is away to add a Control to the
header. It interesting to know what was used in outlook 2003 when u choose
contacts and choose by category view or by phone list. there is a row under
the header that let u add a contact thats exactly the solution i need. i
dont belive the outlook team used 2 datagrids.
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:Oy**************@TK2MSFTNGXA01.phx.gbl...
Hi milk-jam,

Sorry, but with my further research, I found that the header row of the
DataGridView is highly encapsuled. So I don't suggest you to do this. You
can try to add ComboBoxes above the DataGridView to achieve this.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #10
Hi milk-jam,

Actually the grid control used in Outlook is different from the one in
VS.NET. In Microsoft, each product team implents their own controls. So
because the Outlook team has the souce code for their grid control, they
can customize it to satisfy thieir needs. However, the DataGridView in
VS.NET is highly encapsuled to meet general requirements, it's hard for us
to do such a job on it. I think your solution is fine for workaround. I'm
sorry for the inconvenience.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #11

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

Similar topics

1
by: Job Lot | last post by:
How can I filter/search records in DataGridView after filling it with data? The BindingNavigator provides default functionality for navigating, adding, deleting and saving records. Is there...
3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
1
by: Rich | last post by:
Hello, I need to change the font size of a datagridview to accommodate a screen resolution of 800x600. I know how to set the fontsize at runtime datagridview1.Font = New Font("arial", 8,...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
7
by: Ryan | last post by:
I have a DataGridView which displays numeric (Int32) data from an underlying database. I want the numbers to be displayed in numeric format "#,###" (with commas). I want to also limit the user so...
2
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.", ...
2
by: ewingate | last post by:
What is the real difference between the DataView and the DataGridView? Is the DataView even a control or is it merely a class? With methods that allow you to edit rows and columns it seems like it...
3
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm trying to add a datagridview control to a Windows Form to display read-only information in visual basic 2005. My understanding is that datareader will be faster for this purpose. I have the...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
I want to develop a datagridview allowing column selection and filtering, like this: http://www.codeproject.com/KB/grid/GridFilter.aspx This example is using dataset. My question is if: a) I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.