Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8110333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:42:55+00:00 2026-06-06T01:42:55+00:00

Hello I have a datatable that I would like to filter with a single

  • 0

Hello I have a datatable that I would like to filter with a single textbox, non-case sensitive. In other words when a user starts typing into the textbox, I would like the RowFilter to display any rows that CONTAIN the typed information (again regardless of case).

My current code will only display exact matches and only for a single column (“ID”). There are a few other columns I want to include, i.e. “Title”, “User Name”, “Company”, etc.

Any ideas?

private void searchTextBox_TextChanged(object sender, EventArgs e)
{
   if (searchTextBox.Text.Trim() != "")
   {
      gridToTable.DefaultView.RowFilter = "ID = " + searchTextBox.Text;
   }
   else
   {
      gridToTable.DefaultView.RowFilter = string.Empty;

   }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:42:57+00:00Added an answer on June 6, 2026 at 1:42 am

    You can use LIKE in the RowFilter and concat all flters with OR.

    var rowFilter = string.Format(
            "ID LIKE '%{0}%' OR TITLE LIKE '%{1}%' OR Company LIKE '%{2}%' OR UserName LIKE '%{3}%'"
            , txtSearchID.Text
            , txtSearchTitle.Text
            , txtSearchCompany.Text 
            , txtSearchUserName.Text
        );  
    gridToTable.DefaultView.RowFilter = rowFilter;
    

    DataColumn.Expression Property (same syntax for DataView.RowFilter)

    But to be honest, i would suggest to use LINQ-to-DataSet instead since it’s much more powerful.

    For example:

    DataTable tblFiltered = gridToTable.AsEnumerable()
                           .Where(r => r.Field<int>("ID").ToString().Contains(txtSearchID.Text) 
                                    || r.Field<string>("TITLE").Contains(txtSearchTitle.Text)
                                    || r.Field<string>("Company").Contains(txtSearchCompany.Text)
                                    || r.Field<string>("UserName").Contains(txtSearchUserName.Text))
                           .CopyToDataTable();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello I have this code that use to sort a datatable. Dim sortingIndex As
Hello I have a xml file from whihc i would like ot have a
Hello I have a Dynamic DataTable Created at runtime. The Setup is like so
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
hello i have a app that connects and post to user wall but when
Hello I have a item list that shows on my asp.net page like this:
hello I have a page ( http://schema.org/WebPage ) that contains a review ( http://schema.org/Review
Hello i have that grid pane and there is labels and textboxes in that
Hello i have a TextField on my scene. It haves only digits, user input
Hello I have the code below that for some reason is not working: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.