Filter DataTable with a value from a dropdown list

Posted on 2013-09-28
Medium Priority
Last Modified: 2013-09-30

I have a DataGrid populated from a DataTable ( DataGrid1.DataBind() ).
I also have a dropdownlist and a button.
I need to know how to filter DataGrid  or DataTable with the value from the dropdownlist  when I press the button.

Thank you,
Question by:Qw M
LVL 14

Accepted Solution

dejaanbu earned 2000 total points
ID: 39530866
you can use rowfilter property of the dataview before assigning the datatable to the gridview:

LVL 13

Expert Comment

by:Naman Goel
ID: 39531188
There are two ways to achieve this, create a dataview out of datatable and bind it with datagridview.

for more information refer to following link:


then filter the dataview again with filter criteria.

DataTable dt= new DataTable();

DataView dv=new DataView(dt);

grid.DataSource= dv;

for filtering

  dv.RowFilter = "<filercolumn>='" + dropdownlist.SelectedItem "'"

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question