Click here to Skip to main content
15,892,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone, sorry for my language at once, translated Google.

There is a DataGrid and filled it like this:
C#
dataGrid1.ItemsSource = dt.DefaultView;


Filter I by this method:
C#
((DataView)dataGrid1.ItemsSource).RowFilter = "fname = 'fname1'";


If I click on fname1, it only shows fname1
If I click on fname2, it only shows fname2

How to do that when you click on fname1 fname2 and he showed and fname1 and fname2?

http://s020.radikal.ru/i715/1212/8d/c0d40af3a341.jpg
Posted

 
Share this answer
 
Hi Cant understand . So Pls improve your question
 
Share this answer
 
DataGrid I fill like this:
C#
String strConnection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection con = new SqlConnection(strConnection);
            con.Open();
            DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter("Select * from RNames", con);
            SqlCommandBuilder cmd = new SqlCommandBuilder(da);
            da.Fill(dt);
            dataGrid1.ItemsSource = dt.DefaultView; 


Filtering in the DataGrid is as follows:
C#
private void checkBox1_Checked(object sender, RoutedEventArgs e)
       {
     ((DataView)dataGrid1.ItemsSource).RowFilter = "fname = 'fname1'";
       }

C#
private void checkBox2_Checked(object sender, RoutedEventArgs e)
       {
  ((DataView)dataGrid1.ItemsSource).RowFilter = "fname = 'fname2'";
       }


And how to do that when you click on checkBox1 and checkBox2, are displayed in the
fname1 lname1
fname2 lname2
 
Share this answer
 
v2
Help please. Or again, I do not understand explained?
 
Share this answer
 

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