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

[Solved] GridView: Combobox Column Filtering Dependency with other Combobox Column

3 Answers 172 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Parvinder Singh
Top achievements
Rank 1
Parvinder Singh asked on 15 Oct 2010, 10:48 AM
Hi, 

I am trying to achieve below functionality on GridView Combobox column:

We have 2 Collection 1st have list of countries with Country-ID & 2nd have list of all cities of all countries with City-ID & respective Country-ID so, ItemSource of 1st Combobox column is binded with Country-Collection & 2nd with City-Collection, so they are successfully populating data on edit (click on Combobox-column-cell) & on load it shows country & city from back-end too.

But my requirement is when user changes or selects Country from 1st column, on 2nd column all the cities from that selected country should be filter out i.e. it should only show those cities which have Country-ID under selected Country.  

I tried many options for above requirements but still not able to achieve the desired result. 

Any help is appreciated. 


3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 15 Oct 2010, 11:26 AM
Hi Parvinder Singh,

You may take a look at this blog post for a reference.
 

Sincerely yours,
Maya
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
Parvinder Singh
Top achievements
Rank 1
answered on 18 Oct 2010, 09:06 AM
Hi Maya,

Thank you for your feedback.
I reviewed sample example, but in our scenario we are following MVVM architecture
1) Gridview: shows all the entries from database with edit & update option and it is binded with the Customers

So when i applied sample example:

1) When I tried to bind AvailableCites like as shown in example i.e. "<telerik:GridViewComboBoxColumn  ItemsSourceBinding="{Binding AvailableCountries}" DataMemberBinding="{Binding CountryID}" Header="Country" DisplayMemberPath="Name" SelectedValueMemberPath="ID" Width="400" />"
It throws an exceptions "Invalid property or field - AvailableCites for type Customer "

2) Then I tried to databind in code behind with viewModel.AvailableCites and following was the result:
1) OnLoad: it was showing all the countries in gridviewcomboboxcolumn but all the cities was blank 
2) OnClick  country_gridviewcomboboxcolumn it was loading and showing respective cities in city_gridviewcomboboxcolumn 
 but not saving & onClick next row, previous selected value is disappearing.    

0
Maya
Telerik team
answered on 18 Oct 2010, 11:13 AM
Hi Parvinder Singh,

Considering the first exception you are getting, I may suppose that you do not expose a property responsible for keeping the available cities in your case. Do you have such a property inside your Customer class ?
As for the second scenario, I may assume that the DataMemberBinding is not set properly in your application.
Thus, in order to provide you with an appropriate solution, I would need more details about your settings. It would be great if you could send us a sample project (via support ticket) so that I could see your exact requirements. 

Kind regards,
Maya
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
Tags
GridView
Asked by
Parvinder Singh
Top achievements
Rank 1
Answers by
Maya
Telerik team
Parvinder Singh
Top achievements
Rank 1
Share this question
or