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

GridViewComboBoxColumn not selecting previously saved value

1 Answer 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
spam
Top achievements
Rank 1
spam asked on 30 Jul 2013, 12:50 AM
I have a grid w/ a combobox in the first column. If I exclude SelectedValueMemberPath="ID", the default value doesn't get chosen when I load up the grid BUT the comboBOx is populated. If I include SelectedValueMemberPath="ID" in the xaml, the same thing happens except after a i select a value in the column, if i click on another column, the value in the combobox dissappears & the combobox is blanked. Forcing me to reselect. 

Can someone please provide an answer to this problem or an example project that has a telerik 
grid w/ a comobox that allows me to save the combox value and reopen the grid w/ the saved value selected? 

I've been working on this 5 days now. :(

Thank you kindly.

PS: I should also mention, the values in the combobox come from 2 tables & combines. One of them doesn't have IDs so I generate unique interger IDs in C# when the value data is loaded. The value generated are consistent each time & not random.


<telerikGridView:RadGridView Name="grdSortSequence" IsReadOnly="False"
                                        VerticalAlignment="Stretch"
                                        ItemsSource="{Binding SortSequenceLines, Mode=TwoWay}"
                                        SelectedItem="{Binding SelectedSequenceLine, Mode=TwoWay}"
                                        AutoGenerateColumns="False" 
                                        IsFilteringAllowed="False"                                      
                                        RowIndicatorVisibility="Collapsed"
                                        ShowGroupPanel="False"
                                        CanUserDeleteRows="True"
                                        Margin="2"
                                        MinHeight="150" MaxHeight="200"                                    
                                        Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="6" Width="400" Height="160">
            <telerikGridView:RadGridView.Columns>
                 
                <telerikGridView:GridViewComboBoxColumn Header="ChangeAttributeTo" UniqueName="AttributeName" Width="120"  ValidatesOnDataErrors="None"                                                   
                                                    DataMemberBinding="{Binding Attribute, Mode=TwoWay}"                                                                                                                                                            
                                                    DisplayMemberPath="Name"
                                                    SelectedValueMemberPath="ID"/>
                 
                <telerikGridView:GridViewDataColumn x:Name="txtAttribute"
                                                    Header="Attribute" 
                                                    Background="Silver"
                                                    IsReadOnly="True"
                                                    DataMemberBinding="{Binding AttributeName, Mode=TwoWay}"                                                   
                                                    UniqueName="AttributeName" />
                 
                <telerikGridView:GridViewDataColumn x:Name="txtLength"
                                                    Header="Length"      
                                                    DataMemberBinding="{Binding Length, Mode=TwoWay}"                                                   
                                                    UniqueName="Length" />
 
                <telerikGridView:GridViewDataColumn x:Name="chkIsDescending"
                                                    Header="Descending"                                                   
                                                    DataMemberBinding="{Binding IsDescending, Mode=TwoWay}"                                                   
                                                    UniqueName="Descending" />
                 
                <telerikGridView:GridViewDataColumn x:Name="txtSequence"
                                                    Header="Sequence"                                                  
                                                    DataMemberBinding="{Binding SequenceNumber, Mode=TwoWay}"                                                   
                                                    UniqueName="Name" />
 
            </telerikGridView:RadGridView.Columns>
        </telerikGridView:RadGridView>

This is my class that reflex a record in the grid...
public class SequenceLine
{
    public GeneralSettings.Module.ViewModels.Attribute Attribute { get; set; }
    public string AttributeName { get; set; }
    public int ClassCodeGroupID { get; set; }
    public int SequenceNumber { get; set; }
    public int Length { get; set; }
    public Boolean? IsDescending { get; set; }
}

And this is the Attribute class that is in the comboBox.

 
public class Attribute
{
    public int ID { get; set; }
    public string Name { get; set; }
}





1 Answer, 1 is accepted

Sort by
0
spam
Top achievements
Rank 1
answered on 08 Aug 2013, 07:55 PM
Can Anyone help me on this? NO comments at all? Really?
Tags
GridView
Asked by
spam
Top achievements
Rank 1
Answers by
spam
Top achievements
Rank 1
Share this question
or