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

GridViewComboBoxColumn shows empty rows

2 Answers 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 28 Oct 2009, 09:28 PM
I am trying similar to this code to show data in gridcombo but it shows empty rows. The number of rows in combo matches with number of List<> items but all are blank. I tried this in SL 3 Q2 and also in Q3 beta.

Can you please provide working sample? Also in demo can you please point where I can find similar sample?

GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn();
             comboColumn.HeaderText =
"Country";
             comboColumn.DataMemberBinding =
new Binding("CountryID");
             comboColumn.ItemsSource = GetCountries();
             comboColumn.DisplayMemberPath =
"Name";
             comboColumn.SelectedValueMemberPath  =
"ID";
             
this.RadGridView1.Columns.Add(comboColumn);

private System.Collections.IEnumerable GetCountries()
         {
             List<Country> countries =
new List<Country>();
             countries.Add(
new Country(){ID=0, Name = "Germany"});
             countries.Add(
new Country(){ID=1, Name = "Spain"});
             countries.Add(
new Country(){ID=2, Name = "UK"});
             
return countries;
         }

Thanks,
Jay

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 30 Oct 2009, 02:19 PM

Hello Jay,

Your code is absolutely OK. If you click on a cell to start edit you should see the combo box editor .

Now the problem is in the display mode of the cells. I am wondering why do you not see any value.

Things you should check first are :
1. Does the CountryID column contain valid values ( e.g. integers in the range 0-2)
2. Is the type of the CoutryId column Integer or by accident  a string ?

For your reference I am attaching  a sample illustrating a combo box column in action.

* Note that when using GridViewComboBox column the ComboBox editor is visible when the cell is in edit mode.

Greetings,

Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gio
Top achievements
Rank 1
answered on 24 Nov 2011, 04:13 PM
Resolved without static resource, but with cellTemplate.
This template is used only for view data, while on edit is used the combo box.

<tlk:GridViewComboBoxColumn Header="Categoria"
    ItemsSource="{Binding Path=EntitiesAdditional[Categorie], Mode=TwoWay}"
    DataMemberBinding="{Binding Path=Categorie, Mode=TwoWay}"
    DisplayMemberPath="Nome"
        <tlk:GridViewColumn.CellTemplate
            <DataTemplate
                <TextBlock Text="{Binding Categorie.Nome}"></TextBlock
            </DataTemplate>  
        </tlk:GridViewColumn.CellTemplate
</tlk:GridViewComboBoxColumn>
Tags
GridView
Asked by
Jay
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Gio
Top achievements
Rank 1
Share this question
or