Andreas Haeusler
Top achievements
Rank 2
Andreas Haeusler
asked on 20 Oct 2015, 09:10 AM
Hello,
is there any way to access a collection of the cells/rows that match the search criteria?
I'm trying to implement a combined search/filter - function -- using the SearchProgressChangedEvent to hide all rows that do not match the search criteria.
Kind regards,
Andreas
3 Answers, 1 is accepted
0
Hello Andreas,
Thank you for writing.
Here is a sample code snippet demonstrating how to get the search results in RadGridView:
You can find additional information in the Search Row help article.
As to the filtering case, you can refer to our Demo application >> GridView >> Filtering >> Custom filtering example which uses the custom filtering functionality to hide the rows that do not match the criterion.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Thank you for writing.
Here is a sample code snippet demonstrating how to get the search results in RadGridView:
public
Form1()
{
InitializeComponent();
this
.radGridView1.AllowSearchRow =
true
;
this
.radGridView1.MasterView.TableSearchRow.InitialSearchResultsTreshold = 0;
this
.radGridView1.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged;
}
private
void
TableSearchRow_SearchProgressChanged(
object
sender, Telerik.WinControls.UI.SearchProgressChangedEventArgs e)
{
if
(e.SearchFinished ==
false
&& e.SearchCriteria !=
null
&& e.SearchCriteria !=
string
.Empty)
{
Console.WriteLine(
"Search results: "
+ e.Cells.Count);
foreach
(GridSearchResultCellInfo c
in
e.Cells)
{
Console.WriteLine(c.RowInfo.Cells[c.ColumnInfo.Name].Value);
}
}
}
You can find additional information in the Search Row help article.
As to the filtering case, you can refer to our Demo application >> GridView >> Filtering >> Custom filtering example which uses the custom filtering functionality to hide the rows that do not match the criterion.
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Andreas Haeusler
Top achievements
Rank 2
answered on 21 Oct 2015, 01:55 PM
Hello Dess,
thank you for your feedback -- that is similar to how i approached the issue... only difference: i waited for e.SearchFinished == true.
It's not very intuitive that SearchProgressChangedEventArgs.Cells is NULL once the search is over.
I will modify my code accordingly.
Thanks again,
Andreas
0
Hello Andreas,
Thank you for writing back.
Indeed, it is not very intuitive and it should be improved. That is why I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.
Dess
Telerik
Thank you for writing back.
Indeed, it is not very intuitive and it should be improved. That is why I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.
I have also updated your Telerik points.
I hope this information helps. If you have any additional questions, please let me know.
Dess
Telerik
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 Feedback Portal
and vote to affect the priority of the items