Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Experts i m using this code for filter datagrid row value by the textchanged but it not running in proper way :-

C#
private void tbSearchText_TextChanged(object sender, EventArgs e)
        {

            Friends.con.Open();
           str = "SELECT EmployeeName  From Admin ";
                cmd = new OleDbCommand(str, Friends.con);
                OleDbDataAdapter da = new OleDbDataAdapter(cmd);
                DataTable dtEmployee = new DataTable();
                da.Fill(dtEmployee);

                if (dtEmployee.Rows.Count > 0)
            {
                dtEmployee.DefaultView.RowFilter = "EmployeeName Like '" + tbSearchText.Text + "*'";
                dtEmployee.DefaultView.Sort = "EmployeeName";
                DGVEmployeeResult.ClearSelection();
            }
            Friends.con.Close();
                
        }


I m Using Window Form I have a gridview i want to filter row of gridview by the textbox changed letter which i entered ...............it is not working
Posted
Updated 2-Mar-14 14:01pm
v4
Comments
Garth J Lancaster 2-Mar-14 16:42pm    
"it is not working" ... given we cant see what's happening on your pc, that's not really a help description - you need to explain the actual result you are getting vs desired in a bit more detail dude
Rohit85 3-Mar-14 1:03am    
when i enter text in text box it is anable to filter and sort the datagrid value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900