
Victoria F
Top achievements
Rank 1
Victoria F
asked on 14 Dec 2010, 10:44 PM
dgv_format.DataSource = dtSource;
dgv_format.MasterTemplate.FilterDescriptors.Clear();
FilterDescriptor filter = new FilterDescriptor();
filter.PropertyName = "a_layer_number";
filter.Operator = FilterOperator.IsEqualTo;
filter.Value = 1 ;
filter.IsFilterEditor = true;
dgv_format.MasterTemplate.FilterDescriptors.Add(filter);
dgv_format.Refresh();
Does not filter ....
What could be wrong here ?
I tried to filter not using
MasterTemplate
.. also does not filter, does not work :dgv_format.FilterDescriptors.Add(filter);
Thank you ,
Victoria.
7 Answers, 1 is accepted
0

Richard Slade
Top achievements
Rank 2
answered on 14 Dec 2010, 11:16 PM
Hi Victoria,
This is striaght from the docs at this link
In your example, what is the PropertyName set to? I think this needs to be the column name and not the FieldName.
Let me know if that helps or if you need more information
Regards,
Richard
This is striaght from the docs at this link
FilterDescriptor filter =
new
FilterDescriptor();
filter.PropertyName =
"ProductName"
;
filter.Operator = FilterOperator.Contains;
filter.Value =
"Qu"
;
filter.IsFilterEditor =
true
;
this
.radGridView1.FilterDescriptors.Add(filter);
In your example, what is the PropertyName set to? I think this needs to be the column name and not the FieldName.
Let me know if that helps or if you need more information
Regards,
Richard
0

Richard Slade
Top achievements
Rank 2
answered on 14 Dec 2010, 11:21 PM
Hi again,
There you go, just to verify it must be the column name and not the field name, this works
Sorry it's in VB, but the principal is the same
Richard
There you go, just to verify it must be the column name and not the field name, this works
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
Me
.RadGridView1.MultiSelect =
True
Me
.RadGridView1.AllowRowResize =
False
Me
.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
Me
.RadGridView1.Columns.Add(
New
GridViewTextBoxColumn(
"A"
))
Me
.RadGridView1.Columns.Add(
New
GridViewDecimalColumn(
"B"
))
Me
.RadGridView1.Columns(
"A"
).FieldName =
"AColumn"
Me
.RadGridView1.Columns(
"B"
).FieldName =
"BColumn"
Dim
rowInfo
As
GridViewRowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A1"
rowInfo.Cells(1).Value = 2.99
rowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A2"
rowInfo.Cells(1).Value = 3.99
rowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A3"
rowInfo.Cells(1).Value = 635
rowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A4"
rowInfo.Cells(1).Value = 635
Me
.RadGridView1.BestFitColumns()
' Enable Filtering
Me
.RadGridView1.EnableFiltering =
True
Dim
filter
As
New
FilterDescriptor()
'filter.PropertyName = "AColumn" // No - must be column name
filter.PropertyName =
"A"
filter.[Operator] = FilterOperator.Contains
filter.Value =
"A2"
filter.IsFilterEditor =
True
Me
.RadGridView1.FilterDescriptors.Add(filter)
End
Sub
Sorry it's in VB, but the principal is the same
Richard
0

Victoria F
Top achievements
Rank 1
answered on 14 Dec 2010, 11:22 PM
Richard , thank you very much for your quick responses ..
I tried this also .. the only difference in my case is numeric column. So I'm filtering Int16 column.
In debugger it 's perfect FilterDescriptors = " a_layer_number = 1 " . That's what I'm expecting.. but dgv_format.FilterDescriptors.Add(filter); does not do anything..
Is it possible that I set some properties on the gridview that prevent filtering ?
Thank you
Victoria.
I tried this also .. the only difference in my case is numeric column. So I'm filtering Int16 column.
In debugger it 's perfect FilterDescriptors = " a_layer_number = 1 " . That's what I'm expecting.. but dgv_format.FilterDescriptors.Add(filter); does not do anything..
Is it possible that I set some properties on the gridview that prevent filtering ?
Thank you
Victoria.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 14 Dec 2010, 11:23 PM
Have you turned on EnableFiltering?
Richard
this
.radGridView1.EnableFiltering =
true
;
0

Victoria F
Top achievements
Rank 1
answered on 14 Dec 2010, 11:35 PM
Yees , Thank you ... that's what it was !!!!
Victoria.
Victoria.
0

Richard Slade
Top achievements
Rank 2
answered on 14 Dec 2010, 11:35 PM
Hi Victoria,
This also works, setting the filter on the GridViewDecimalColumn and giving the filter an integer value
let me know if you need more help
Richard
This also works, setting the filter on the GridViewDecimalColumn and giving the filter an integer value
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
Me
.RadGridView1.MultiSelect =
True
Me
.RadGridView1.AllowRowResize =
False
Me
.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
Me
.RadGridView1.Columns.Add(
New
GridViewTextBoxColumn(
"A"
))
Me
.RadGridView1.Columns.Add(
New
GridViewDecimalColumn(
"B"
))
Me
.RadGridView1.Columns(
"A"
).FieldName =
"AColumn"
Me
.RadGridView1.Columns(
"B"
).FieldName =
"BColumn"
Dim
rowInfo
As
GridViewRowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A1"
rowInfo.Cells(1).Value = 3
rowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A2"
rowInfo.Cells(1).Value = 4
rowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A3"
rowInfo.Cells(1).Value = 5
rowInfo =
Me
.RadGridView1.Rows.AddNew()
rowInfo.Cells(0).Value =
"A4"
rowInfo.Cells(1).Value = 6
Me
.RadGridView1.BestFitColumns()
'' Enable Filtering
Me
.RadGridView1.EnableFiltering =
True
Dim
filter
As
New
FilterDescriptor()
'filter.PropertyName = "AColumn" // No - must be column name
filter.PropertyName =
"B"
filter.[Operator] = FilterOperator.IsEqualTo
filter.Value = 4
filter.IsFilterEditor =
True
Me
.RadGridView1.FilterDescriptors.Add(filter)
End
Sub
let me know if you need more help
Richard
0

Richard Slade
Top achievements
Rank 2
answered on 14 Dec 2010, 11:36 PM
Ah, great. We posted at the same time :o)
Glad that's sorted.
All the best
Richard
Glad that's sorted.
All the best
Richard