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

GridViewComboBoxColumn lost value when lost focus.

5 Answers 488 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pam
Top achievements
Rank 1
Pam asked on 25 Apr 2011, 02:31 AM
Hi, in my gridview i have a GridViewComboBoxColumn, i have filled it with data but when i select a value and i move to another cell, the previous selected value gets lost and it's blank. Any ideas of how to solve this?

this is my code
GridViewComboBoxColumn gridComboBox = new GridViewComboBoxColumn();
gridComboBox.DataMemberBinding = new Binding("ElementoCatalogo");
gridComboBox.Header = "Afinidad";
gridComboBox.Width = 200;
gridComboBox.SelectedValueMemberPath = "ID";
gridComboBox.DisplayMemberPath = "Descripcion";
List<ElementoCatalogo> lista = new List<ElementoCatalogo>();
lista = EnlacesDLL.Logic.CatalogoLogic.seleccionarCatalogo("AFINIDAD");
gridComboBox.ItemsSource = lista;
gridCandidaturas.Columns.Add(gridComboBox);

5 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 25 Apr 2011, 09:14 AM
Hello Pam,

Can you please paste the implementation of the business objects you are binding to - the ones used as a items source for RadGridView and the ones used as items source for the combo .
I will try to reproduce the problem here and see what went wrong.

Kind regards,
Pavel Pavlov
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
Pam
Top achievements
Rank 1
answered on 25 Apr 2011, 03:19 PM
This is my radGridView declaration on XAML:
<telerik:RadGridView AllowDrop="False" AutoGenerateColumns="False" CanUserDeleteRows="True" CanUserFreezeColumns="True" CanUserInsertRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" IsFilteringAllowed="False" IsScrolling="False" Margin="12,9,6,22" Name="gridCandidaturas" RowDetailsVisibilityMode="Visible" RowIndicatorVisibility="Collapsed" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Silver" Grid.Row="2">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding Puesto}" Header="Puesto" HeaderTextAlignment="Center" TextAlignment="Center" Width="200" />
                <!--<telerik:GridViewComboBoxColumn Name="cboGridAfinidad"  DataMemberBinding="{Binding Afinidad}" Header="Afinidad" HeaderTextAlignment="Center" TextAlignment="Center" Width="200" />-->
                <!--<telerik:GridViewDataColumn DataMemberBinding="{Binding Comentarios}" Header="Comentarios" HeaderTextAlignment="Center" TextAlignment="Center" Width="100*" />-->
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>


This is the business object for the gridView
public class ResultadoCandidatura
    {
        public int CandidaturaID { get; set; }
        public string Candidatura { get; set; }
        public int AfinidadID { get; set; }
        public string Descripcion { get; set; }
        public string Comentarios { get; set; }
    }
 
And this is for the comboBoxColumn
public class ElementoCatalogo
    {
        public int ID { get; set; }
        public string Descripcion { get; set; }
        public int TipoID { get; set; }
    }
0
Accepted
Pavel Pavlov
Telerik team
answered on 25 Apr 2011, 03:34 PM
Hi Pam,

you need to set properly the the following set of properties of the Combo column , in order to have it working correctly:

DataMemberBinding ,SelectedValueMemberPath, DisplayMemberPath and ItemsSource.

This is described in details in this online help article .

In your code I see only a setting : DataMemberBinding="{Binding Afinidad}" and no Afinidad property on either of your business objects. There is AfinidadID , but no Afinidad.

Kind regards,
Pavel Pavlov
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
Pam
Top achievements
Rank 1
answered on 25 Apr 2011, 10:19 PM
Yes, it had a problem with that. After checking the link you post and checking my business objects, it finally worked. Thank you!
0
nilam
Top achievements
Rank 1
answered on 30 Aug 2016, 10:53 AM

please help for combo box column in WPF data grid after value selection lost value from current cell

here my code is :

 <dg:DataGridComboBoxColumn  Header="Select" Width="100" x:Name="Tablex"  ItemsSource="{Binding lstTableName1}" 
                  TextBinding="{Binding Tablex}" SelectedValueBinding="{Binding Tablex}"
                                           
                            DisplayMemberPath = "TableName" SelectedValuePath="TableName"/>

 

Tags
GridView
Asked by
Pam
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Pam
Top achievements
Rank 1
nilam
Top achievements
Rank 1
Share this question
or