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

GridViewComboBoxColumn shows no data and not visible in column

2 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 08 Sep 2011, 07:58 AM

Requirements

RadControls version

 

.NET version

 

Visual Studio version

 

programming language

 

browser support

all browsers supported by RadControls


Dear Telerik team,
 I'am running my own company and recently started with developing silverlight applications.
At this moment I have difficulties with the GridViewComboBoxColumn.
In the debugger I can see that data is loaded into the combo but when clicking the related column no combo will be displayed.
I saw other people having similar problems on google but did not find a solution yet.

I hope you can help me out.
 Many thx's

My code is as follows :

Class holding data for the combo
using System;
using System.Collections.Generic;
 
namespace gridview
{
    public class Amount
    {
        private double _AmountValue;
        private long _AmountID;
 
        public long AmountID
        {
            get { return _AmountID; }
            set { _AmountID = value; }
        }
 
        public double AmountValue
        {
            get { return _AmountValue; }
            set { _AmountValue = value; }
        }
    }
}

The xaml file
    <Grid x:Name="demoGridview" Background="White" Height="300" Width="1000">
        <telerik:RadGridView x:Name="RadGridView1" Margin="26,0,-60,-86"
							 RowIndicatorVisibility="Collapsed" IsReadOnly="True" MinHeight="386" MaxHeight="500"
							 AutoGenerateColumns="False" CanUserFreezeColumns="False" CanUserResizeColumns="False" 
                             AlternateRowBackground="Azure" CanUserDeleteRows="False" CanUserInsertRows="False" DataLoaded="RadGridView1_DataLoaded">
            <telerik:RadGridView.Columns>
                <telerik:GridViewToggleRowDetailsColumn />
                <telerik:GridViewComboBoxColumn Header="Aantal"         Width="50"  DataMemberBinding="{Binding AmountID}" SelectedValueMemberPath="AmountID" DisplayMemberPath="AmountValue" UniqueName="AmountValues"/>
                <telerik:GridViewComboBoxColumn Header="Leverancier"    Width="200" DataMemberBinding="{Binding SupplierID}" SelectedValueMemberPath="SupplierID" DisplayMemberPath="SupplierValue" UniqueName="SupplierValues"/>
                <telerik:GridViewComboBoxColumn Header="OrderType"      Width="100" DataMemberBinding="{Binding OrderTypeID}" SelectedValueMemberPath="OrderTypeID" DisplayMemberPath="OrderTypeValue" UniqueName="OrderTypeValues"/>
            </telerik:RadGridView.Columns>
            <!-- specify the objects when the row is expanded by the customer -->
            <telerik:RadGridView.RowDetailsTemplate>
                <DataTemplate>
                    <StackPanel Height="60" HorizontalAlignment="Left" Name="StackUserInput" VerticalAlignment="Top">
                        <Grid x:Name="grdUserInput" Background="White" Width="1000" Height="60" ShowGridLines="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="5"></RowDefinition>         <!-- dummy to create an offset from the top-->
                                <RowDefinition Height="25"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"></ColumnDefinition>   <!-- dummy to create an offset from the left-->
                                <ColumnDefinition Width="150"></ColumnDefinition>
                                <ColumnDefinition Width="200"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <sdk:Label Height="22" HorizontalAlignment="Left" Name="lblInternalRemark" Content="Opmerking intern" VerticalAlignment="Top" Width="127" Grid.Row="1" Grid.Column="1"/>
                            <TextBox Height="22" HorizontalAlignment="Left" Name="txtInternalRemark" VerticalAlignment="Top" Width="150" Grid.Row="1" Grid.Column="2"/>
                            <sdk:Label Height="22" HorizontalAlignment="Left" Name="lblExternalRemark" Content="Opmerking extern" VerticalAlignment="Top" Width="127" Grid.Row="2" Grid.Column="1" />
                            <TextBox Height="22" HorizontalAlignment="Left" Name="txtExternalRemark" VerticalAlignment="Top" Width="150" Grid.Row="2" Grid.Column="2"/>
                        </Grid>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadGridView.RowDetailsTemplate> 
        </telerik:RadGridView>
    </Grid>

The related cs file
        private void RadGridView1_DataLoaded(object sender, EventArgs e)
        {
            FillAmountvalues();
        } 
            private void FillAmountvalues()
            {
                List<Amount> AmountList = new List<Amount> 
                {
                    new Amount { AmountID=1,AmountValue=1 },
                    new Amount { AmountID=2,AmountValue=2 },
                    new Amount { AmountID=3,AmountValue=3 },
                    new Amount { AmountID=4,AmountValue=4 },
                    new Amount { AmountID=5,AmountValue=5 }
                };
 
                try 
                {
                    GridViewComboBoxColumn comboBoxColumnAmount = (RadGridView1.Columns["AmountValues"as GridViewComboBoxColumn);
                    if (comboBoxColumnAmount != null)
                    {
                        comboBoxColumnAmount.ItemsSource = AmountList;
                    }
                }
 
                catch (NullReferenceException err)
                {
                    Console.WriteLine("an error has occured namely '" + err.Message + "'");
                }
 
                finally
                {
                    Console.WriteLine("amounts added to the combo");
                }
            #endregion
        }


2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 13 Sep 2011, 10:06 AM
Hello Rob,

I tried to reproduce the behavior you described, but still without any success. Please take at the sample attached and let me know in case of any misunderstandings.
 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Rob
Top achievements
Rank 1
answered on 13 Sep 2011, 12:13 PM
Dear Maya,

Thanks for your feedback.
I was lucky this morning to recover the behaviour of my problem but there was no time yet to inform you, my apologize
I overlooked the gridview property 'IsReadOnly', this was set to true.
This will cause that no combo's in the columns will be displayed.

so it seems that the grid is working fine now.

thx

best regards

Rob

Tags
GridView
Asked by
Rob
Top achievements
Rank 1
Answers by
Maya
Telerik team
Rob
Top achievements
Rank 1
Share this question
or