This is a migrated thread and some comments may be shown as answers.

Filter other RadComboBox content on RadGrid Filter

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mosart
Top achievements
Rank 1
Mosart asked on 17 Apr 2013, 09:03 PM
Hello, I have a RadGrid to display a list of items.

Columns:
Client Name | Invoice | Item description

What I'm trying to accomplish is to filter the second RadComboBox data, when the first one is used (filter).
For instance, when customer John Smith is selected as a filter, I'd like to rebind the RadComboBox "Invoice" to show only the invoices of John Smith. As of today, it rebinds, but uses the full dataset, so it shows all invoices.

Data is in a Dataset in a session variable.
Client Name and Invoice each have a RadComboBox setup as a FilterTemplate.
RadGrid is using the "NeedDataSource" event to bind.
On RadGrid's ItemCreated event (when item created is a GridFilteringItem), I find and call RadComboBox's DataBind, using the dataset as DataSource.

Is there a way to do that (without having to run RadComboBoxes as standalone objects)?

Thank you.
Mosart

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 22 Apr 2013, 12:39 PM
Hi,

Your approach seems correct. You have correctly setup the FilterTemplate functionality of RadGrid in order to introduce RadComboBox as filterable control. Additionally, you have hooked the ItemCreated event which is the correct event where you need to bind the data.

What I do not understand is what you mean by "without having to run RadComboBoxes as standalone objects". Could you elaborate on that part?

What you should in order to filter the second ComboBox's datasource is to hook the SelectedIndexChanged event of the first ComboBox control and in its body to prepare the datasource for the second ComboBox control.

You could find sample implementation of the relation in this online demo application. The application does not show the scenario with RadGrid, however, the approach is identical.

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Mosart
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or