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

GridViewComboBoxColumn as a list of values

2 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Francois
Top achievements
Rank 1
Francois asked on 16 Jun 2011, 06:50 PM
Hi, I would like to have a ComboBox column in my grid that would be used as a list of values that the user can select, modify or use a new one.

I mapped the ValueMember to a string property of my custom object and set the DropDownStyle to DropDown. It gets saved properly, but I cannot edit the value nor add a 'custom' one.

I can't find a property that let me do that, am I doing something wrong or that functionality is not present?

Also, I would like to be able to add new lines, as it is possible in the GridViewTextBoxColumn but it doesn't seem possible in the ComboBoxColumn.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Francois
Top achievements
Rank 1
answered on 21 Jun 2011, 12:57 PM
Do the lack of answer mean that it cannot be done?
0
Svett
Telerik team
answered on 21 Jun 2011, 04:12 PM
Hi Francois,

Thank you for contacting us.

The desired behavior can be achieved by creating a custom editor based on the drop down list editor. You can read more on how to create editors in this documentation article. Here is the basic class that you should extend:

public class CustomDropDownEditor : RadDropDownListEditor
{
    protected override RadElement CreateEditorElement()
    {
        RadDropDownListEditorElement element = base.CreateEditorElement() as RadDropDownListEditorElement;
        // This makes the editor be multi-line editor as your requirements
        element.TextBox.TextBoxItem.Multiline = true;
        return element;
    }
}

I hope you find this useful. Let me know if you have further queries.

Kind regards,
Svett
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Francois
Top achievements
Rank 1
Answers by
Francois
Top achievements
Rank 1
Svett
Telerik team
Share this question
or