Declined
Last Updated: 02 Apr 2021 09:15 by ADMIN
Trustteam
Created on: 02 Apr 2021 07:44
Category: GridView
Type: Feature Request
0
How can I set a GridViewMultiComboBoxColumn at design time

Hi,

I want to add a MultiComboBoxColumn to a GridView

is it possible to define the columns for this MultiComboBox at design time (in Property Builder editor of Grid) ?

3 comments
ADMIN
Nadya | Tech Support Engineer
Posted on: 02 Apr 2021 09:15

Hello,

GridViewMultiComboBoxColumn provides design-time support for the most important grid properties including the DataSource property which populates the internal grid with the specified data collection. Unbound mode for the EditorControl at design time is not supported due to the specific nature of the grid editors, which get reused for performance reasons. The CellEditorInitialized event is the appropriate place to set up the desired columns for the editor in unbound mode. More information about this you can find here: https://docs.telerik.com/devtools/winforms/controls/gridview/columns/column-types/gridviewmulticomboboxcolumn 

The following code snippet demonstrates how you can add columns to EditorControl in GridViewMultiComboBoxColumn. Please note that we have a flag because the editors in RadGridView are reused. If we do not have such a flag, new Name and Code columns will be added each time a RadMultiColumnComboBoxElement editor is opened.

public RadForm1()
{
    InitializeComponent();
    this.radGridView1.CellEditorInitialized += this.RadGridView1_CellEditorInitialized;
}
bool isColumnAdded;
private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    if (e.Column is GridViewMultiComboBoxColumn)
    {
        if (!isColumnAdded)
        {
            isColumnAdded = true;
            RadMultiColumnComboBoxElement editor = e.ActiveEditor as RadMultiColumnComboBoxElement;
            editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("Name"));
            editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("Code"));
            editor.EditorControl.Rows.AddNew();
        }
    }
}

I hope this information helps. Let me know if you have further questions.

Regards,
Nadya
Progress Telerik

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/.

Trustteam
Posted on: 02 Apr 2021 08:27

Hi,

After I add this GridViewMultiComboBoxColumn to grid

how can I set (at design time) the columns I want to see in the dropdown of this column ?

 

I have a grid, on this grid I want to have a MultiComboBoxColumn: Country

at run time, when I edit a row in grid, in the dropdown of Country column I want to see 2 columns: Name and Code

How can I add, at design time, columns Name and Code to Country MultiComboBoxColumn ?

 

ADMIN
Nadya | Tech Support Engineer
Posted on: 02 Apr 2021 08:00

Hello, Trustteam,

Yes, it is possible to add GridViewMultiComboBoxColumn at design time. When you click the smart tag in RadGridView a new dialog would show and you should navigate to the Columns section:

Then, from the drop-down list in GridViewDataColumn Collection Editor choose the GridViewMultiComboBoxColumn and it should be automatically added to the grid:

I will change the status of this feature request to Declined since this is already supported functionality. 

Should you have other questions do not hesitate to contact us. 

Regards,
Nadya
Progress Telerik

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/.