I have a customized grid where i change the type of the editorElement in one cell based on the value on another cell.
One of this editors are the RadDropDownListEditorElement. The displaymembers shows nicly when dropped down.
But when i choose one of the elements in the dropdown list, the dropdown closes and the valuemember is presented in the cell.
I need the valuemember in some operations after this, but i want the cell to show the displaymember.
Here is the code in the CellEditorInitialized:
6 Answers, 1 is accepted
A suggestion would be to swap the valuemember in this way
and then you could always store the value in the tag property for later inspection.
hope that helps
This is what i initially had done. How can i add the VALUE into the TAG if I only have the TEXT and the TEXT is not unique in the database table.
And why is the ValueMember shown in the cell?
Even though this is not exactly replicating your exmaple, it does show that you can set the display as one value, and using CellFormatting, set the tag to another value.
Hope that helps
As far as I can see from your code snippet, you perform customization of the column's editor. When you close the editor, the value of the cell depends on the properties of its GridViewComboBoxColumn.
Your case could be implemented in the following way:
1. Create GridViewComboBoxColumn and set DataSource to it. The DataSource should contain all possible data, which will be used in the differently customized editors of the column.
2. Set the column's ValueMember and DisplayMember.
3. Perform your logic in the CellEditorInitialized event handler to customize the editor of the column.
I hope it will help you to achieve your scenario.
the Telerik team
As far as I can tell from the Telerik replies here, DisplayMember and ValueMember don't really work. If they did, the Text property would always contain what's in the DisplayMember and the Value property would always contain what's in the ValueMember. Instead, we're told to store the ValueMember in the Tag so as to have it handy. Have I misunderstood?
I got here because I've been having similar problems.
This seems to be quite an old forum post. Please have in mind that GridViewComboBoxColumn displays a set of predefined text values in a drop down list. This column type is typically used to provide a lookup into some set of relatively static values. The DisplayMember controls which property value of the applied DataSource to be displayed in the cells. The ValueMember determines which property value to be stored as a value in the cells. The following help article demonstrates how to setup such a column in RadGridView: https://docs.telerik.com/devtools/winforms/controls/gridview/columns/column-types/gridviewcomboboxcolumn
If you are still experiencing any further difficulties, it would be greatly appreciated if you can submit a support ticket from your Telerik account and provide more information about the exact setup that you have on your end and what is the exact requirement that you are trying to achieve. Thus, we would be able to get better understanding of the precise case and provide further assistance. Thank you in advance.
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Dess | Tech Support Engineer, Sr.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.