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

RadGridView ComboBoxColumn displays no value for member with empty string value is selected

2 Answers 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alain
Top achievements
Rank 1
Alain asked on 22 Feb 2013, 08:05 PM
Hi, I am using a RadGridView and have a column that is a GridViewComboBoxColumn.
The ComboBox is bound to a collection of values that are :

ValueMember : DisplayMember
"" : [None]
A : A
B : B
C : C

If the user selects value member A, B or C, all is fine and the associated display member is displayed.
But if the user selects the value member "" (an empty string) the display member [none] is not displayed and the ComboBox displays nothing.  It is like as if when I select an empty string the list will by default go back to selectedIndex = -1.

Here's a code example:

public class ItemComboBox
    {
        public string CleItem { get; set; }
        public string ValeurItem { get; set; }
    }
 
List<ItemComboBox> liste = new List<ItemComboBox>();
liste.add(new ItemComboBox("", "[None]"));
liste.add(new ItemComboBox("A", "A"));
liste.add(new ItemComboBox("B", "B"));
liste.add(new ItemComboBox("C", "C"));
 
//cboInsRslCd is my ComboBoxColumn
cboInsRslCd.DataSource = liste;
cboInsRslCd.ValueMember = "CleItem";
cboInsRslCd.DisplayMember = "ValeurItem";

Anyway, to have my [None] display member to be displayed correctly when the empty string value is selected?
Thanks!

2 Answers, 1 is accepted

Sort by
0
Alain
Top achievements
Rank 1
answered on 22 Feb 2013, 09:27 PM
I forgot to mention that I am using the CellEditorInitialized event to filter the list of values in the bound list.  I just realized that the problem might be linked to that.  If I disable the CellEditorInitialized event, I can select the member «"", [None]» and the comboBox really displays [None] instead of Nothing.

So, depending on the value of another cell on the same row the cellEditor initializes my combobox with only some of the values of the list that is bound to the combobox.  But whatever the value, the member «"", [None]» is always available in the list.

0
Accepted
Svett
Telerik team
answered on 26 Feb 2013, 03:24 PM
Hi Alain,

I managed to reproduce the issue and I logged it in
our public issue tracking system. It will be addressed in one of the next releases. Meanwhile, you should set the NullValue property of the column to work around it:
cboInsRslCd.NullValue = "[None]";

I updated your Telerik points accordingly.

Regards,
Svett
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
GridView
Asked by
Alain
Top achievements
Rank 1
Answers by
Alain
Top achievements
Rank 1
Svett
Telerik team
Share this question
or