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

RadGridView GridViewComboBoxColumn with depended values

1 Answer 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ilia
Top achievements
Rank 1
Ilia asked on 22 Mar 2019, 09:02 AM

Hello I'm trying to add depandable comboboxes to RadGridView and my Comoboxes always empty. What I do wrong? For examle I want to add Club and Players to grid - Select Club and then Select Player from players of this Club

                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Name, Mode=TwoWay}" 
                                                ItemsSource="{Binding ClubList}" Width="120" IsReadOnly="False" Header="Club Name" 
                                                SortMemberPath="Name"
                                                SelectedValueMemberPath="Name" 
                                                IsComboBoxEditable="True"
                                                telerik:TextSearch.TextPath="Name"
                                                DisplayMemberPath="Name"
                />
                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding PlayerName, Mode=TwoWay}" 
                                                ItemsSource="{Binding PlayerList}" Width="120" IsReadOnly="False" Header="Player Name" 
                                                SortMemberPath="Name"
                                                SelectedValueMemberPath="Name" 
                                                IsComboBoxEditable="True"
                                                telerik:TextSearch.TextPath="Name"
                                                DisplayMemberPath="Name"
                />

public class ClubLinks : INotifyPropertyChanged

{

        public string Name
        {
            get { return this.name; }
            set
            {
                if (value != this.name)
                {
                    this.name = value;
                    this.OnPropertyChanged("Name");
                }
            }
        }

        public string PlayerName { get; set; }

        private ObservableCollection<Club> _clubs;
        public ObservableCollection<Club> ClubList
        {
            get
            {
                if (this._clubs == null)
                {
                    this._clubs = Club.GetClubs();
                }

                return this._clubs;
            }
        }

    public ObservableCollection<Player> PlayerList
        {
            get
            {
                if (null == this.players)
                {
                    this.players =
                     new ObservableCollection<Player>()
                        {
                            new Player(){Name = "Pl1_" + name},
                            new Player(){Name = "Pl2_" + name},
                            new Player(){Name = "Pl3_" + name},
                            new Player(){Name = "Pl4_" + name},
                        };
                }

                return this.players;
            }
        }

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 26 Mar 2019, 02:21 PM
Hello Ilia,

May I ask you to check out the ComboBox Column article in our documentation and the ComboboxColumn SDK example? The mentioned resources demonstrate how you can setup a GridViewComboBoxColumn in the desired way. 

Additionally, you can also check out the ComboboxColumnEditable and ComboboxColumnItemsSourceBinding SDK example.

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Ilia
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or