Hi,
I have implemented the filtering using a combobox as shown in this article:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/filtering/google-like-filtering
I am wondering if its possible once one column is filtered to restrict what's available in the other combobox filters?
So if I filter on the first two columns, I want the next column filter to only show what is available in the grid after filtering, not what is in the datasource.
Thanks
5 Answers, 1 is accepted
In order to have the RadComboBox filters show only the relevant items from the data source you should get the FilterExpression for the grid. Then you can use that expression in the query that retrieves data for the RadComboBox.
I have prepared a sample project that outlines the approach. It is attached to this post.
Try to use similar approach and you should be able to implement the behavior you are looking for.
Regards,
Viktor Tachev
Telerik
Hi,
Thanks for the response and sample demo.
We are using viewstate to store the grid's datasource in the usercontrol that contains the grid. Is there any way to access the Grid's Datasource from the custom column in order to filter on it as per your example?
I know we could store it in each column but obviously that would consume more memory. Currently setting the comboboxes datasource as a list of strings - this is being set in the onNeedDataSource event of the grid, selecting the relevant field for that column.
Thanks,
Gary
Note that keeping large amount of data in the ViewState is not recommended and should be avoided. This could considerably hinder the performance of the application.
In the sample the data for the RadComBox is retrieved from the database. Usually the connection between the database and the web server would be a lot faster than the connection of the end user. Thus, this approach should work faster than using the ViewState to store the data. When having a large ViewState the user will need to download it and that could negatively impact the user experience.
Regards,
Viktor Tachev
Telerik
The DataSource of the grid will be null within the OnItemRequested event of the RadComboBox control, so it will not be possible use that data source and set it to the DataSource property of the RadComboBox. The DataSource of the RadGrid will contain the data object only within the life cycle when the data is bound to the control. This means that you will have to retrieve the DataSource directly from the ViewState.
Hope this helps.
Regards,
Konstantin Dikov
Telerik