473,383 Members | 1,798 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,383 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 13317
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.