Multi column in combobox with IsComboBoxEditable="True" is Error

3 posts, 0 answers
  1. tuan
    tuan avatar
    10 posts
    Member since:
    Apr 2009

    Posted 18 Apr 2011 Link to this post

    Hi, I use GridView with combobox (multi columns in combobox) and IsComboBoxEditable="True" is display error (errorgridview.png)

    My code axml follow as:
    <telerik:RadGridView Name="grvData" AutoGenerateColumns="False" >
                <telerik:GridViewComboBoxColumn Header="Country" 
                            DataMemberBinding="{Binding Code}" 
                            Width="150"  IsComboBoxEditable="True" 
                        <Style TargetType="telerik:RadComboBox">
                            <Setter Property="SelectionBoxTemplate">
                                        <TextBlock Text="{Binding Code}" Margin="5">
                            <Setter Property="ItemTemplate">
                                                <ColumnDefinition Width="100"></ColumnDefinition>
                                                <ColumnDefinition Width="200"></ColumnDefinition>
                                            <TextBlock Text="{Binding Code}" Margin="5" ></TextBlock>
                                            <TextBlock Text="{Binding Name}" Margin="5" 

    and cs:
    public partial class MainPage : UserControl
           public MainPage()
               List<Country> list1 = new List<Country>();
               list1.Add(new Country() { Code = "eng", Name = "English" });
               list1.Add(new Country() { Code = "vni", Name = "Viet Nam" });
               list1.Add(new Country() { Code = "chi", Name = "China" });
               this.grvData.ItemsSource = list1;
               ((GridViewComboBoxColumn)this.grvData.Columns["Country"]).ItemsSource = list1;
       public class Country
           public string Code { get; set; }
           public string Name { get; set; }

    please help me!

  2. Maya
    Maya avatar
    4062 posts

    Posted 18 Apr 2011 Link to this post

    Hi tuan,

    You may override the ToString() method in your Country class:

    public class Country
            public string Code{get;set;}
            public string Name{get;set;}
            public override string ToString()
                return this.Name;

    Thus the editor will not return the whole object, but rather the corresponding value for the Name property.

    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
  3. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 29 Apr 2013 Link to this post

    Mistake.  To delete
Back to Top