Ludovic Gerbault
Top achievements
Rank 1
Ludovic Gerbault
asked on 30 Dec 2009, 10:41 AM
Hello
I've tried to implement the functionnality presented in the demo "Search as you type"
It usually works fine except in one case.
If there is in the grid a GridViewImageColumn for instance, the whole thing just crash because of a cast exception between GridViewDataColumn and GridViewImageColumn.
If you change it GridViewColumn, the CreateFilterMethod doesn't work, and if you try to select only the GridViewDataColumn from the RadGrid, ignoring the GridViewImageColumn, then nothing happens when you type.
Any workaround for that in your minds ?
I've tried to implement the functionnality presented in the demo "Search as you type"
It usually works fine except in one case.
If there is in the grid a GridViewImageColumn for instance, the whole thing just crash because of a cast exception between GridViewDataColumn and GridViewImageColumn.
If you change it GridViewColumn, the CreateFilterMethod doesn't work, and if you try to select only the GridViewDataColumn from the RadGrid, ignoring the GridViewImageColumn, then nothing happens when you type.
Any workaround for that in your minds ?
9 Answers, 1 is accepted
0
Hello Subileau Pascal,
I hope this helps.
Greetings,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Make the constructor of CustomFilterDescriptor accept an IEnumerable of GridViewColumns.
Then below, see whether the column is a data column and only if it is, cast it and create a filer on it. Something like this:
public
CustomFilterDescriptor(IEnumerable<GridViewColumn> columns)
{
this
.compositeFilterDesriptor =
new
CompositeFilterDescriptor();
this
.compositeFilterDesriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
foreach
(var column
in
columns)
{
GridViewDataColumn dataColumn = column
as
GridViewDataColumn;
if
(dataColumn !=
null
)
{
this
.compositeFilterDesriptor.FilterDescriptors.Add(
this
.CreateFilterForColumn(column));
}
}
}
I hope this helps.
Greetings,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kristof
Top achievements
Rank 1
answered on 24 Mar 2010, 04:07 PM
I have also the same problem...
The search don't work...
I did the same like in the demo but I used GridViewColumn with images and GridViewDataColumn in my RadGridView.
The difference with my CustomFilterDescriptor class is that I check if the type of column is GridViewDataColumn.
But it's also don't work...
CustomFilterDescriptor class:
Is there a solution?
Thanks and regards,
Kristof
The search don't work...
I did the same like in the demo but I used GridViewColumn with images and GridViewDataColumn in my RadGridView.
The difference with my CustomFilterDescriptor class is that I check if the type of column is GridViewDataColumn.
But it's also don't work...
CustomFilterDescriptor class:
Public Sub New(ByVal columns As IEnumerable(Of GridViewColumn)) |
Me.compositeFilterDesriptor = New CompositeFilterDescriptor() |
Me.compositeFilterDesriptor.LogicalOperator = FilterCompositionLogicalOperator.[Or] |
Try |
For Each column As GridViewColumn In columns |
Dim dataColumn As GridViewDataColumn = TryCast(column, GridViewDataColumn) |
If dataColumn IsNot Nothing Then |
Me.compositeFilterDesriptor.FilterDescriptors.Add(Me.CreateFilterForColumn(dataColumn)) |
End If |
Next |
Catch ex As Exception |
Throw ex |
End Try |
End Sub |
Is there a solution?
Thanks and regards,
Kristof
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 24 Mar 2010, 04:48 PM
try to select only the GridViewDataColumns which are of type String
My code looks like this :
this.ClientsGrid.Columns.OfType<GridViewDataColumn>().Where(x=>x.IsVisible == true && x.DataType == typeof(String))
My code looks like this :
this.ClientsGrid.Columns.OfType<GridViewDataColumn>().Where(x=>x.IsVisible == true && x.DataType == typeof(String))
0
Kristof
Top achievements
Rank 1
answered on 25 Mar 2010, 09:13 AM
I tried the following...
But it still don't work...
Public ReadOnly Property CustomFilterDescriptor() As CustomFilterDescriptor |
Get |
If Me.m_customFilterDescriptor Is Nothing Then |
Dim dataCols = (From col In Me.grdMCPOverview.Columns.OfType(Of GridViewDataColumn)() _ |
Let dataType = col.DataType _ |
Where (col.IsVisible) And (dataType Is GetType(String)) _ |
Select DirectCast(col, GridViewColumn)).ToList() |
Me.m_customFilterDescriptor = New CustomFilterDescriptor(dataCols) |
Me.grdMCPOverview.FilterDescriptors.Add(Me.m_customFilterDescriptor) |
End If |
Return Me.m_customFilterDescriptor |
End Get |
End Property |
But it still don't work...
0
Hi Kristof,
Could you please open a separate support ticket and send us a sample project. We will look into it.
All the best,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Could you please open a separate support ticket and send us a sample project. We will look into it.
All the best,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jamest
Top achievements
Rank 2
answered on 04 Jun 2010, 09:27 PM
@Subileau Pascal - Thank you, that fixed my issue of the filtering appearing not to work.
CustomFilterDescriptor = new CustomFilterDescriptor(this.RadGrid_Packages.Columns.OfType<GridViewDataColumn>().Where(x => x.IsVisible == true && x.DataType == typeof(String))
CustomFilterDescriptor = new CustomFilterDescriptor(this.RadGrid_Packages.Columns.OfType<GridViewDataColumn>().Where(x => x.IsVisible == true && x.DataType == typeof(String))
0
aubrey
Top achievements
Rank 1
answered on 14 Sep 2011, 07:34 AM
hi Subileau,
how can i select only the GridViewDataColumns which are of type String or int?
can you help me figure this out, i've tried it but it doesn't work.
hoping for your reply,
Aubrey :)
how can i select only the GridViewDataColumns which are of type String or int?
can you help me figure this out, i've tried it but it doesn't work.
hoping for your reply,
Aubrey :)
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 14 Oct 2011, 09:09 AM
Something like
raddatagrid.Columns.OfType<GridViewDataColumn>().Where(x.DataType == typeof(String) || x.DataType == typeof(Int32))
Should do the trick :)
raddatagrid.Columns.OfType<GridViewDataColumn>().Where(x.DataType == typeof(String) || x.DataType == typeof(Int32))
Should do the trick :)
0
Almond
Top achievements
Rank 1
answered on 18 May 2012, 09:23 AM
Hello Telerik Gurus,
Can anyone give an example of the below inquiry using EF?
It will be very much appreciated :)
Thanks in advance.
almond
Can anyone give an example of the below inquiry using EF?
It will be very much appreciated :)
Thanks in advance.
almond