473,379 Members | 1,170 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,379 software developers and data experts.

How to filtering data in a datagrid dynamically?

Hi,

I am using a data grid which is filled up with the data from the table. I have given two choices to the user. One a combobox is given having four columns in the list from which user can select a column name. Second a text box is given in which he can type the value. Based on the values of the column name and value i want to filter out records in the data grid. But don't know how. I am not using dataset only data grid is filled up directly from the table.

Please help me.

Thanks in advance
Jan 29 '11 #1
3 3296
If you have a DataTable as your DataSource for the DataGridView, and you want to sort or filter the list, one way would be to use a DataView. Here is an MSDN page with an example of how to do it:

http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx

Basically what you'd be doing is creating a view of the table data and setting the RowFilter property to be like the "where" clause of a SQL statement. Then you can use the DataView as the DataSource for the grid instead of the DataTable.
Jan 29 '11 #2
Thanks a lot bentleyw
Jan 30 '11 #3
No worries. Glad to help.
Feb 1 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sam Vanderstraeten | last post by:
Hi All, - Visual Studio 2002 - VB.NET > ASP.NET I created a DataGrid on a webform. This datagrid has sorting enabled. I want to create in the header of each column (that is a...
1
by: New User | last post by:
I have a xml file for datasource.e.g <Persons> <Person> <Name>User1</Name> <State>NJ</State> </Person> <Person> <Name>User2</Name> <State>WA</State> </Person>
4
by: bill | last post by:
Can I add multiple datagrid controls dynamically at runtime? I want to break up my dataset into separate datagrids, so I can insert a "<p style="page-break-before: always"> tag between them. ...
4
by: david | last post by:
I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4...
7
by: coleenholley | last post by:
Hi all :-) I have a couple of web pages created using ASP.Net and VB code-behind. We use a connection call through an RPC to COBOL, NOT an SQL connection, so my connection to get the data is done...
0
by: news.zen.co.uk | last post by:
Hi Guys, Using VB .NET 2003 and ASP1.1, I have a Datagrid embedded in an ASP page. In the processing of the ItemDataBound event I dynamically create a new Datagrid control within the Cell of the...
7
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...
2
by: santoshsri | last post by:
Hello, I will have to add textboxes in a datagrid Dynamically using Add button in C# Can anyone provide me a code snippet for this work. Thanks , San
2
menayah
by: menayah | last post by:
Dear All, 1. I need to add columns to the datagrid dynamically in Vb .net web form how to that ? 2. How to make a scroll bar for the data grid ? 3. what is the best solution to view data...
0
by: lucindaa | last post by:
Hi EveryBody, i have a problem in setting the column type of datagrid dynamically in C# .Net Windows App. i am generating the grid automatically by assigning datasource of a datatable the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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...

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.