Click here to Skip to main content
15,888,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have a datagrid view which i need to filter based on search textbox and one combo box when i select the column from the combobox (there are 12 columns in my table) and click button the filtered items should display. my problem is like i can hardcore like below this code works only for that particular column not for the other columns

C#
table.DefaultView.RowFilter = "USER_NAME='" + txtSearch.Text + "'";



it displays for only one column how should i do the code for all tweleve columns ?????


someone pls help me
Posted
Updated 23-May-12 20:22pm
v2

1 solution

You can specify multiple conditions in the RowFilter. You can form the expression which is quite similar to SQL.

Details here:
MSDN: DataColumn.Expression Property [^]
MSDN: DataView.RowFilter Property[^]

Sample:
C#
myDataView.RowFilter = "Name = 'Sandeep' AND JoinDate > '1/1/2010'"; 
 
Share this answer
 
Comments
Member 8983639 24-May-12 5:45am    
ythanks alot
Sandeep Mewara 24-May-12 5:56am    
Welcome.

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