Click here to Skip to main content
16,006,065 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one table called podaci, one form on which I have DataGridView which is bound to podaci. I want to have combobox or textbox, whichever in which when I type a number of one specific column in podaci so it only shows that row in DataGridView. basically I need a filter for it.

anyone can help me ?????
Posted

private void txtPretragaB_TextChanged(object sender, EventArgs e)
{
this.podaciBindingSource.Filter = string.Format("Bankomat LIKE \'{0}%\";, this.txtPretragaB.Text);
}


I DID IT!!!!!! this works

no button, just typed in what I want and there it is, it filters everything out except what I have in textbox
 
Share this answer
 
Comments
OriginalGriff 29-Apr-11 8:19am    
Well done!
Gets a five for sorting it yourself, and telling everybody what the solution you found was.
Keep it up :thumbsup:
Assign table values to Data view object. Data View has filter option.
dataView.RowFilter = "ColumnName = 'John'"

Here in place of 'Jhon' you can pass whatever value is provided in textbox/Combobox.

Assign dataview to Gridview.datasource.
 
Share this answer
 
v2

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