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

How to set up MultiComboBoxColumn?

18 Answers 701 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 11 Feb 2009, 04:46 PM
Hi,

I have MutliComboBoxColumn in grids and I need to adjust widths of this combo columns (displayed when I drop down combo). I failed to find any way how to do this from designer or code. Is there any way how to alter columns of this in-grid combo? Thx

Daniel

18 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 12 Feb 2009, 06:10 PM
Hi Daniel,

Thank you for your question. Please use the following code:

private void Form1_Load(object sender, EventArgs e) 
           
  ((RadGridView)multiComboBox.EditorControl).Columns["columnName"].Width = 170; 

Do not hesitate to write me back if you have further questions.

Regards,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Daniel
Top achievements
Rank 1
answered on 12 Feb 2009, 06:17 PM
Hi Nick,

what you posted applies to RadMultiColumnComboBox control, not GridViewMultiComboBoxColumn, which is multicolumn combo in grid. Is there any way how to achieve something similar with GridViewMultiComboBoxColumn? Thx

Regards,
Daniel
0
Nick
Telerik team
answered on 16 Feb 2009, 10:03 AM
Hello Daniel,

Thank you for your question. Please use the following work-around:

 
        private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) 
        { 
            if (this.radGridView1.ActiveEditor is RadMultiColumnComboBoxElement) 
            { 
                ((RadGridView)((RadMultiColumnComboBoxElement)this.radGridView1.ActiveEditor).EditorControl).Columns[0].Width = 200; 
            } 
        } 

Do not hesitate to write me back if you have further questions.

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Daniel
Top achievements
Rank 1
answered on 16 Feb 2009, 10:49 AM
Hi Nick,

thanks for the answer. This is however not very nice solution when you need to set column widths and other parameters, which can be set once, then reused. This way it'll have to be done every time column/cell is being edited.

I think it'd be appropriate to have such ability to set up multi-column combo column's drop down properties (columns, widths, headers, etc.) in design time via designer.

Cheers,
Daniel
0
Nick
Telerik team
answered on 16 Feb 2009, 05:28 PM
Hi Daniel,

Thank you for your feedback. I have updated your Telerik points. We are going to add design time support soon.

Greetings,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Khanh Son
Top achievements
Rank 1
answered on 26 May 2009, 07:18 AM
Hi,

I have MultiComboBoxColumn in the grid. This column is binded to datasource already.
I face 2 issues and hope anybody would help me to figure it out.

Issue #1: can not add a column into grid-combo MultiComboBoxColumn.
I could use RadMultiColumnComboBoxElement to interact with grid-combo(for example, iterating the columns inside MultiComboBoxColumn) as I did with RadMultiColumnComboBox. But unlike MultiColumnComboBox, I can not add a new column using RadMultiColumnComboBoxElement.
I try to handle with CellBeginEdit event (RadGridView) but it throw exception ("A column with the same Name already exists in the collection") at second-click row.

Issue #2: can not "add new row" into grid-combo of MultiComboBoxColumn.
I also use RadMultiColumnComboBoxElement as Issue #1, but AddNewRow does not working.
Pls take a look at code below:
void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) 
        { 
            if (radGridView1.ActiveEditor is RadMultiColumnComboBoxElement) 
            { 
                RadMultiColumnComboBoxElement multiComboBoxElement = (RadMultiColumnComboBoxElement)radGridView1.ActiveEditor; 
 
                multiComboBoxElement.EditorControl.MasterGridViewTemplate.AllowAddNewRow = true
                multiComboBoxElement.EditorControl.MasterGridViewTemplate.AddNewRowPosition = PinnedRowPosition.Top; 
                multiComboBoxElement.EditorControl.MasterGridViewTemplate.BestFitColumns(); 
 
                GridViewDataColumn colDetails = new GridViewDataColumn(); 
                colDetails.UniqueName = "Details"
                colDetails.HeaderText = "Details"
                colDetails.DataType = typeof(string); 
 
                multiComboBoxElement.Columns.Add(colDetails); 
            } 
        } 


I use Q3 2008 version. Pls give me a suggestion how to fix it.

Thanks
SonTK



0
Martin Vasilev
Telerik team
answered on 29 May 2009, 07:13 AM
Hello Khanh Son,

Thank you for writing.

Because of the reuse of editors in RadGridView, you have to check if the new column is a non existing before trying to add it. Otherwise, you are trying to add it every time when CellBeginEdit fires. Also I have tested AddNew method with Q3 2008 and it works as expected. You have to keep in mind that it adds a blank row and you have to manually populate it with data after that. Please, review the code-block below:

void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)  
{  
    if (radGridView1.ActiveEditor is RadMultiColumnComboBoxElement)  
    {  
        RadMultiColumnComboBoxElement multiComboBoxElement = (RadMultiColumnComboBoxElement)radGridView1.ActiveEditor;  
 
        multiComboBoxElement.EditorControl.MasterGridViewTemplate.AllowAddNewRow = true;  
        multiComboBoxElement.EditorControl.MasterGridViewTemplate.AddNewRowPosition = PinnedRowPosition.Top;  
        multiComboBoxElement.EditorControl.MasterGridViewTemplate.BestFitColumns();  
 
        if (multiComboBoxElement.Columns.Count < 3) //check if the column has not already been added  
        {  
            GridViewDataColumn colDetails = new GridViewDataColumn();  
            colDetails.UniqueName = "Details";  
            colDetails.HeaderText = "Details";  
            colDetails.DataType = typeof(string);  
 
            multiComboBoxElement.Columns.Add(colDetails);  
        }  
 
        GridViewDataRowInfo row = multiComboBoxElement.Rows.AddNew();  
        row.Cells["Details"].Value = "Some details";  
    }  

I hope this helps. Do not hesitate to contact me again if you have other questions.

Regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Khanh Son
Top achievements
Rank 1
answered on 02 Jun 2009, 07:53 AM
Hello Martin,

Before receiving your solution, I solved the issue "Add Details column" by adding a member into object which List<object> is used as Datasource.

I try with your solution and it worked as well.
Thanks you so much and thanks Telerik.

Regards,
Khanh Son

0
Martin Vasilev
Telerik team
answered on 04 Jun 2009, 11:46 AM
Hello Khanh Son,

Thank you for getting back to me. I am glad that the suggested approach suits your scenario. Actually, adding the column in the DataSource is another way as well. Write me back if you need additional assistance.

All the best,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ajay
Top achievements
Rank 1
answered on 16 Dec 2009, 12:41 PM
Hi
Team Telerik

i am using the telerik version "2009.1.9.414" , I am using multicoloum combobox in grid .
I am facing issues :
1) When i click the cell with previously assigned value, the multicoloum combobox gets in edit mode but the assigned value get lost and value gets blank.
2) how to achieve the suggest append functionality in this, similar to normal combo.

Thanks
Ajay Yadav


0
Martin Vasilev
Telerik team
answered on 18 Dec 2009, 08:19 AM
Hello Sharma,

Thank you for contacting us. Please, upgrade to the latest version - Q3 2009 SP1. It contains numerous bug fixes and improvements and it is possible the described behavior to be improved. If you still experience any difficulties, please open a new support ticket and send us a small sample project that demonstrates your scenario. This will help us investigate your case further and provide accurate assistance.

Sincerely yours, Martin Vasilev
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Alain
Top achievements
Rank 1
answered on 10 Apr 2011, 08:24 AM
Hi All,


I'm currently using WINFORM Q1 2011 and trying to set the Headertext and Width of the individual columns programmatically (VB.net) in a GridViewMultiComboBoxColumn but failed to find any satisfactory answer in the help file and above, This is basically the same as the original question posted by Daniel and to which Nick replied: "We are going to add design time support soon.". I wondered whether this is now possible in the Q1 2011 version.


Best regards,
Alain Cavenaile
0
Richard Slade
Top achievements
Rank 2
answered on 11 Apr 2011, 09:29 AM
Hello,

You can reach the RadGridView section of the RadMultiColumnComboBox via "Open Property Builder" from the Smart Tag, or via code using
this.radMultiColumnComboBox1.EditorControl
where EditControl is the RadGridView.

Hope that helps
Richard
0
Ira
Top achievements
Rank 1
answered on 13 Dec 2013, 10:47 PM
I'm wondering what the status of this might be (design time support for configuring columns of a GridViewMultiComboBoxColumn).  I'm using 2013 Q3 and it still seems to be absent.

I am currently converting a project that previously used the Infragistics winform UltraWinGrid.  The Infragistics grid has had design-time support for this sort of thing for well over ten years now.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Dec 2013, 03:29 PM
Hello Ira,

Thank you for contacting Telerik Support.

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.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Peter
Top achievements
Rank 1
answered on 13 Feb 2014, 01:37 PM
I am also using 2013 Q3 and I find it impossible to configure the GridVieMulitComboBoxColumn.  Why Telerik saw it fit to make this task so immensely obscure is completely beyond me.

I have a GridVieMulitComboBoxColumn in a GridView bound to a SQL Server View.  The first column is an ID column, so I wish to hide that but use it later to identify the selection the user has made.  As far as I can tell, it is impossible to configure the columns of this combobox at design time. You cannot hide columns, change column headers, set column width format columns, such as currency, etc. Unless I am missing a major point here, this version is therefore not any better than the one complained about in 2009 already in this thread.

If possible, kindly provide guidance on how to configure this unfathomable control at design time (or at run time, for that matter).

Thanks very much.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Feb 2014, 09:24 AM
Hello Peter,

Thank you for contacting us.

Due to the UI virtualization in RadGridView, editors are being reused. That is why due to the specificity of the editing mechanism, design time support for the GridViewMultiComboBoxColumn editor's columns is not supported. However, you are allowed to change HeaderText or Visibility for the certain column in the popup grid via the CellEditorInitialized event:
private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    if (e.Column is GridViewMultiComboBoxColumn)
    {
        RadMultiColumnComboBoxElement editor = e.ActiveEditor as RadMultiColumnComboBoxElement;
        
        editor.EditorControl.Columns["OrderID"].IsVisible = false;
        editor.EditorControl.Columns["OrderDate"].HeaderText = "Custom text";
    }
}

You can find useful information in our RadGridView online help documentation - section Editors.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
0
Peter
Top achievements
Rank 1
answered on 18 Feb 2014, 10:03 AM
Brilliant!! And so easy once you know how.

 

Thanks very much, it all makes so much more sense now. You guys at Telerik are the best, and WAY ahead of everyone else! 

Best wishes,

Peter

Tags
GridView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Nick
Telerik team
Daniel
Top achievements
Rank 1
Khanh Son
Top achievements
Rank 1
Martin Vasilev
Telerik team
Ajay
Top achievements
Rank 1
Alain
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Ira
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Peter
Top achievements
Rank 1
Share this question
or