473,653 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filtering when using DataGridView

Hi,
I am using a DataGridView to display a large amount of data and so
need to use filters for displaying certain data. For this I want to
provide a textbox for each column of the DataGridView so that the user
can type in any text and use that text as the filter. I would like to
have this textbox row as the first row of the DataGridView just below
the Header.

I saw someone asking this question one year back but there was no
solution suggested then.

Is anyone able to do this now? If so how?

thanks for your help,
Satya.

Apr 24 '06 #1
6 13533
Satya.. I am not sure if using the DataGrid row to do the search is such a
good idea.. but if you have UI requirements.. you can build a UI in such a
way that a row is being used... i.e more like a row of textboxes aligned on
top of the grid columns.. and you could keep them close enough to look as
grid columns.. , your life becomes easier... If I may know why are stuck on
the idea of using a datagrid row?

VJ

"Satya" <sa*********@gm ail.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
Hi,
I am using a DataGridView to display a large amount of data and so
need to use filters for displaying certain data. For this I want to
provide a textbox for each column of the DataGridView so that the user
can type in any text and use that text as the filter. I would like to
have this textbox row as the first row of the DataGridView just below
the Header.

I saw someone asking this question one year back but there was no
solution suggested then.

Is anyone able to do this now? If so how?

thanks for your help,
Satya.

Apr 25 '06 #2
Hi Vijay,
I need the textboxes to appear below the header of the DataGridView
so that the user knows which textbox acts as a filter for which column
of the datagrid. Also, the columns of the DataGridView are configured
via an xml config file, so it is difficult to use textboxes. Also when
the user changes the order of the columns or resizes the columns of the
datagrid it is difficult to do the same with the textboxes.

Hope this clears up my problem. If not please let me know.

thanks,
Satya.

Apr 25 '06 #3
Ok I do understand your case. I am not sure you can do with What windows
offers.. , you could try inheriting and overriding the Grid or the
GridTexboxcolum n to our own objects and work with the grid in the un-bound
mode, and add the rows manually... I have never done something like this...
but I can give a few links that might help you get started in manually
overrides and customizing grid and the grid columns, how to work in un-bound
mode... You could check the below..

http://www.syncfusion.com/faq/windowsforms/default.aspx

www.codeproject.com

Syncfusion also has variety of controls you can use.. try them out.. We use
Syncfusionn for our UI controls, pretty good so far.. We have not used much
of their Grid controls.. so I can't give much insight into that.

Sorry was not able to help you much...
Vijay

"Satya" <sa*********@gm ail.com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Hi Vijay,
I need the textboxes to appear below the header of the DataGridView
so that the user knows which textbox acts as a filter for which column
of the datagrid. Also, the columns of the DataGridView are configured
via an xml config file, so it is difficult to use textboxes. Also when
the user changes the order of the columns or resizes the columns of the
datagrid it is difficult to do the same with the textboxes.

Hope this clears up my problem. If not please let me know.

thanks,
Satya.

Apr 26 '06 #4
What you could maybe do is drop the datagridview and use ListView instead and
incorporate your filters into the ColumnHeader class

Satya wrote:
Hi,
I am using a DataGridView to display a large amount of data and so
need to use filters for displaying certain data. For this I want to
provide a textbox for each column of the DataGridView so that the user
can type in any text and use that text as the filter. I would like to
have this textbox row as the first row of the DataGridView just below
the Header.

I saw someone asking this question one year back but there was no
solution suggested then.

Is anyone able to do this now? If so how?

thanks for your help,
Satya.

Apr 26 '06 #5
In article <11************ **********@v46g 2000cwv.googleg roups.com>, Satya
wrote:
I am using a DataGridView to display a large amount of data and so
need to use filters for displaying certain data. For this I want to
provide a textbox for each column of the DataGridView so that the user
can type in any text and use that text as the filter. I would like to
have this textbox row as the first row of the DataGridView just below
the Header.


I had the same need a while ago. I decided to add "Filter" column to my
DataTable. This column is intended to determine whether or not each row
is filtered. I then insert an empty row into the dataset and freeze it so
it's always onscreen.

In the CellValidated event for the DataGridView, I look to see if the
modified cell is in the filter row. If so, I generate a filter
expression that ands filter expressions (using the contents of each cell
in row zero as an operand for the "LIKE" opeerator). I then assign the
string with the expression to the bindingSource's Filter property.

Hope this helps

Mike

Apr 27 '06 #6
Actually, I was thinking more in MFC terms. On further investigation, ListView
seems severely nobbled in C#
Ian Semmel wrote:
What you could maybe do is drop the datagridview and use ListView
instead and incorporate your filters into the ColumnHeader class

Satya wrote:
Hi,
I am using a DataGridView to display a large amount of data and so
need to use filters for displaying certain data. For this I want to
provide a textbox for each column of the DataGridView so that the user
can type in any text and use that text as the filter. I would like to
have this textbox row as the first row of the DataGridView just below
the Header.

I saw someone asking this question one year back but there was no
solution suggested then.

Is anyone able to do this now? If so how?

thanks for your help,
Satya.

Apr 27 '06 #7

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

Similar topics

0
1351
by: milk-jam | last post by:
How do i use the first raw of my datagridview for filtering the data in the datagridview ?
10
13340
by: milk-jam | last post by:
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...
7
14802
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
7
16411
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....
3
6620
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be implemented simultaneously for multiple columns - but the data need only be sorted by a single column at a time. Sorting should be both ascending and descending. I'm currently using a DataView but it's far too slow, because there are a large...
2
7163
by: Rosco | last post by:
Hello, Quick Overview: I am creating a Windows application using C# and have run across a problem. I’m trying to use a DataGridView in “Bound” mode, but filter the view. I have a database table full of employees called Employees. I wish to display the First Name, Last Name, Employee Id and Social Security Number (SSN) of all employees who have illegitimate social security numbers. Due to the SSN validity check required, I cannot simply...
5
5634
by: BabliS1 | last post by:
I am using Vb.net2005. I have a datagridview which displays some data. I want to filter the records based on some criteria given by the user at runtime. How can I do this. Please Help. Thanks in Advance
0
8370
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
8811
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
8704
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
8470
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
8590
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...
0
7302
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
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
4147
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...
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.