473,729 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13350
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******@newsg roups.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.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: hfa62-0-138-26.bb.netvision .net.il 62.0.138.26
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1187 18
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
misunderstandin g, please feel free to let me know.

In this case, you can try to handle the DataGridView.So rted event. In this
event, you can get the sorted column using DataGridView.So rtedColumn, 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.mic rosoft.com> wrote in message
news:ir******** *****@TK2MSFTNG XA01.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
misunderstandin g, please feel free to let me know.

In this case, you can try to handle the DataGridView.So rted event. In this
event, you can get the sorted column using DataGridView.So rtedColumn, 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.mic rosoft.com> wrote in message
news:H6******** ******@TK2MSFTN GXA01.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.mic rosoft.com> wrote in message
news:H6******** ******@TK2MSFTN GXA01.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.mic rosoft.com> wrote in message
news:Oy******** ******@TK2MSFTN GXA01.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

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

Similar topics

1
6754
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 anything available for filtering/searching records? Is there any Filter Bar available in DataGridView control similar Component One True DBGrid control? Thanks
3
32269
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 datatable without having to loop through each column in the datagridview? Or is there a way to retrieve the rows from the original datatable filtered by the dataview into a separate table? I only want to copy the rows from the main table that...
1
2407
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, FontStyle.Regular) But I would prefer to set this at the property sheet. The datasource for the datagridview is a dataview that I use for filtering.
7
12625
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 the background for my question... Before I switched my application over to the Fx 2.0, I used a DataGrid to display my data. I would store different DataGridTableStyles (each one with a custom set of columns) in the DataGrid.TableStyles property...
7
16453
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 they can only input numerical values. Is there any way to do this? Currently my formatting works but if the user enters a value manually the formatting is not applied to the new value. Also I haven't found a way to allow only numerical input....
2
29661
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,
2
11216
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 would be a control that you could drag and drop on a form in the designer but I cannot find the DataView control in the toolbox. I have used a DataGridView before but I was wondering if DataView has better functionality. Thanks!
3
8538
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 following questions: 1. Can DataReader be bound DIRECTLY to DataGridView? 2. If DataReader cannot be bound directly to DataGridView, how can I load a DataReader into a DataTable and bind the DataTable to DataGridView? Can the DataTable be a...
2
12598
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 use the same way, using dataset b) I use Linq converting a query to dataset c) or if would be done just with Linq
0
8761
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,...
1
9200
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
9142
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...
1
6722
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
6016
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
4525
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
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2162
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.