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

MultiSelectComboBoxColumn in Q1 2011

6 Answers 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 25 May 2011, 04:53 AM
Hi Telerik
I would like to be able to add a Multi select combobox column to GridView.

Would you guys be able to update the code example in the thread at http://www.telerik.com/community/forums/winforms/gridview/multi-select-combobox-column.aspx to reflect the changes needed to work in Q1 2011?

Many thanks in advance
Regards
Ian Carson

6 Answers, 1 is accepted

Sort by
0
Ian
Top achievements
Rank 1
answered on 27 May 2011, 01:47 AM
Hi Telerik

I got what I needed partially working as outlined in the code below

I am stuck on two issues:
1. How best to capture the selections and deselections.  I want to create a list of the selected values.
2. How to stop the editor from closing after a check box has been checked/unchecked

Thanks 
Ian

 
private void rgvParameters_EditorRequired(object sender, EditorRequiredEventArgs e)
{
    if (e.EditorType == typeof(RadDropDownListEditor))
    {
        e.Editor = new MyDropDownListEditor();
    }
}
public class MyDropDownListEditor:RadDropDownListEditor
{
    protected override RadElement CreateEditorElement()
    {
        return new MyDropDownListEditorElement();
    }
      
}
public class MyDropDownListEditorElement:RadDropDownListEditorElement
{
    protected override void OnLoaded()
    {
        base.OnLoaded();
        this.ListElement.CreatingVisualItem += new CreatingVisualListItemEventHandler(ListElement_CreatingVisualItem);
    }
    private void ListElement_CreatingVisualItem(object sender, CreatingVisualListItemEventArgs args)
    {
        RadListVisualItem visualItem = new RadListVisualItem();
        visualItem.Padding = new Padding(12, 0, 0, 0);
        //visualItem.NumberOfColors = 1;
        //visualItem.BackColor = Color.Yellow;
        RadCheckBoxElement chkBox = new RadCheckBoxElement();
        chkBox.MinSize = new Size(12, 12);
        chkBox.MaxSize = chkBox.MinSize;
        chkBox.ToggleStateChanged += new StateChangedEventHandler(chkBox_ToggleStateChanged);
        visualItem.Children.Add(chkBox);
        args.VisualItem = visualItem;
    }
    private void chkBox_ToggleStateChanged(object sender, StateChangedEventArgs args)
    {
        Debug.WriteLine("CheckPressed");
    }
      
}
0
Stefan
Telerik team
answered on 28 May 2011, 09:35 AM
Hi Ian,

Thank you for writing.

RadGridView has undergone a significant change since 2009, including many major upgrade and improvements, together with many new features. Due to these changes, as you have noticed, the approach of getting a multi select combo box should be modified. Please find attached a sample project which demonstrates how you can implement such a scenario. Please note that this is a not fully featured solution and you may need to modify it according to your specific needs.

I hope you find this information helpful.
 
Greetings,
Stefan
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.
0
Martin
Top achievements
Rank 1
answered on 07 Apr 2014, 07:10 PM
Hi Stefan,

i know this is an old Thread, but your "RadDropDownListCustom.zip" ist exactly what i need.
I tried to modify your example that when i edit a cell with already choosen values, the right checkboxes will be checked (in editor mode). Actually the checkboxes are checked from last cell edit of other rows. So "wrong" values were checked. Missing here the read function from cell?
0
Stefan
Telerik team
answered on 08 Apr 2014, 02:19 PM
Hello Martin,

Due to the interest in this topic we have created dedicated KB article for it. Please refer to it here: http://www.telerik.com/support/kb/winforms/gridview/details/mutiselect-drop-down-list-column-in-radgridview.

If you have any additional questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Martin
Top achievements
Rank 1
answered on 08 Apr 2014, 03:28 PM
Hello,

thanks that works fine.

But how i can separate the custom filter function only for this custom column. All other columns have to be the default filter functionality (with filtercolumn and autofilter over ShowHeaderCellButtons) Also a filter combination with other columns should work.
Is there a chance to implement?

Regards,
Martin
0
Stefan
Telerik team
answered on 10 Apr 2014, 01:05 PM
Hi Martin,

Please refer to the other forum thread you have opened regarding the same matter. You will find our answer there. 

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Ian
Top achievements
Rank 1
Answers by
Ian
Top achievements
Rank 1
Stefan
Telerik team
Martin
Top achievements
Rank 1
Share this question
or