Click here to Skip to main content
12,295,482 members (57,206 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# WPF
Hi everyone, sorry for my language at once, translated Google.

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


Filter I by this method:
((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 9-Dec-12 22:55pm
gennc525
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi Cant understand . So Pls improve your question
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

DataGrid I fill like this:
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:
private void checkBox1_Checked(object sender, RoutedEventArgs e)
       {
     ((DataView)dataGrid1.ItemsSource).RowFilter = "fname = 'fname1'";
       }
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
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Help please. Or again, I do not understand explained?
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100