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

Cascading Combobox in a Grid

2 Answers 345 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 26 Apr 2011, 03:00 PM
I have a grid with note types and note subtypes where the ID's for the note subtypes are not unique across all note types, just for the note type they are related to.  Each NoteTpye object has a NoteSubTypes collection property.

Basically they work like below [id]-[value]

1-NoteType1
1-NoteSubType11
2-NoteSubType12
2-NoteType1
1-NoteSubType21
2-NoteSubType22

Because of this when I need to bind the items source of the NoteSubType column to NoteType columns selected NoteType.NoteSubTypes property.  Here's what I have so far:

	    <telerik:RadGridView ItemsSource="{Binding Path=NotesList}" AutoGenerateColumns="False">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn
                        Header="ID"
                        DataMemberBinding="{Binding Path=ID}" />
                    <telerik:GridViewComboBoxColumn
                        Header="NoteType"
                        UniqueName="NoteType"
                        ItemsSource="{Binding Path=NoteTypeList}"
                        DataMemberBinding="{Binding Path=NoteTypeID}"
                        SelectedValueMemberPath="ID"
                        DisplayMemberPath="Name">
                    </telerik:GridViewComboBoxColumn>
 
                    <telerik:GridViewComboBoxColumn
                        Header="NoteSubType"
                        ItemsSource="{???}"
                        DataMemberBinding="{Binding Path=NoteSubTypeID}"
                        SelectedValueMemberPath="ID"
                        DisplayMemberPath="Name">
                        
                    </telerik:GridViewComboBoxColumn>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

I just need to get the NoteSubType ItemSource.  I have a IValueConverter and IMultiConverter already created for this if we need them (from experimentations with other grids).

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 26 Apr 2011, 03:04 PM
Hello Jeremy,

I would recommend you to use an ItemSourceBinding for the second column. You may take a look at this blog post for further reference.
Let me know in case you need any further assistance.
 

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
0
Jeremy
Top achievements
Rank 1
answered on 26 Apr 2011, 05:32 PM
That works, but it does mean putting the lookup for the list that is used for display in a dataobject that is not concerned with display at all. Not really ideal.

Is there a way to reference the value of one column from the binding another?
Tags
GridView
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jeremy
Top achievements
Rank 1
Share this question
or