Here Is My Code...
Here i have one TextBox. When writing some text automatically match the String and find all Row..
now ..but in my code..here Only Filter using "ClientName" i want search that text from all the Column..
How to specify the All The Column in the RowFilter plz give me solution
private void txtSearch_TextChanged(object sender, EventArgs e)
{
dv.RowFilter = "ClientName Like '%" + txtSearch.Text + "%'";
dgClientMaster.DataSource = dv;
}
Try this code:
private void txtSearch_TextChanged(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
foreach (DataColumn column in dv.Table.Columns)
{
sb.AppendFormat("{0} Like '%{1}%' OR ", column.ColumnName, txtSearch.Text);
}
sb.Remove(sb.Length - 3, 3);
dv.RowFilter = sb.ToString();
dgClientMaster.DataSource = dv;
}