Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Sorting DataGrid
Hi,
I have a code that filters the content of the datagrid based on the name(column)
 
private void Filter_Click(object sender, System.Windows.RoutedEventArgs e)
{
    ilterDescriptor filter = new FilterDescriptor("Name", FilterOperator.Contains, (RadGridView1.SelectedItem as Person).Name);
    RadGridView1.FilterDescriptors.Add(filter);
}
 

I want it to be filtered based on the cell on the radgridview that is selected.
 
Can you help me on this?
Posted 14-Apr-11 22:29pm
Edited 14-Apr-11 22:31pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Member 7838027 at 15-Apr-11 9:27am
   
thanks... in my code, the ones that can sorted are only numeric fields (ID(int) and UnitPrice(double)) not the name(string) and date (datetime)... can you help me?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You might want to visit the RadGrid forums. This code looks fine to me.
  Permalink  
Comments
Sandeep Mewara at 15-Apr-11 9:02am
   
Comment from OP:
thanks... in my code, the ones that can sorted are only numeric fields (ID(int) and UnitPrice(double)) not the name(string) and date (datetime)... can you help me?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

private void Filter_Click(object sender, System.Windows.RoutedEventArgs e)
{
    FilterDescriptor filter = new FilterDescriptor(RadGridView1.CurrentCell.Column.UniqueName, FilterOperator.IsEqualTo, RadGridView1.CurrentCell.Value);
    RadGridView1.FilterDescriptors.Add(filter);
}
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 Sergey Alexandrovich Kryukov 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 30 Apr 2011
Copyright © CodeProject, 1999-2014
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