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

Grid view with Multi column combo box

5 Answers 1152 Views
GridView
This is a migrated thread and some comments may be shown as answers.
T S
Top achievements
Rank 1
T S asked on 16 Sep 2015, 05:54 AM

Hello,

 Am using Rad grid view with Multi column combo box.

 I created a Column type as GridViewMultiComboBoxColumn, attached the data source, also included the displaymember, valuemember,dropdwonstyle as RadDropDownStyle.DropDown. and added the column to the grid.

I am facing a problem that if i type in the  GridView MultiComboBox Column, the control is not filtering and showing result.

I got a documentation  saying

The drop-down element is an object of type MultiColumnComboBoxElement. Use this element to set the drop-down style, animation and sizing as you would do for the regular combobox.  
The EditorControl property of the MultiColumnComboBoxElement gives you a reference to the RadGridView control. Using that reference you can obtain the RadGridView object and work as with normal RadGridView control. Refer to RadGridView documentation for additional information on RadGridView.

The current version has one limitation that you should consider:
You cannot use the auto-complete mode of RadDropDownList
The RadGridView control hosted in the drop-down does not allow editing operations
The RadGridView control hosted in the drop-down does not support filtering, grouping and sorting operations.

kindly confirm me is it a limitation or do i need to include something else in my code.

I am including the code snip shot for your ref. 

bool isColumnAdded=false; 

private void Form1_Load(object sender, EventArgs e)
        {
            filldata();​

     }

 

private void filldata()
        {
            SqlCommand cmmdata = new SqlCommand();
            cmmdata.Connection = constkbal;
            cmmdata.CommandText = "select top 50 stockno from itemmaster";
            SqlDataReader srdtls = cmmdata.ExecuteReader();
            DataTable dtdetails = new DataTable();
            dtdetails.Load(srdtls);
            srdtls.Close();
            GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn();
            col.DataSource = dtdetails;
            col.DisplayMember = "stockno";
            col.ValueMember = "stockno";
            col.FieldName = "stockno";
            col.HeaderText = "stockno";
            col.Width = 400;
            col.DropDownStyle = RadDropDownStyle.DropDown;
            col.FilteringMode = GridViewFilteringMode.DisplayMember;
            
            this.griditemdisplay.Columns.Add(col);
     }

private void griditemdisplay_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        {
            if (this.griditemdisplay.CurrentColumn is GridViewMultiComboBoxColumn)
            {
                if (!isColumnAdded)
                {
                    isColumnAdded = true;
                    RadMultiColumnComboBoxElement serchengineElement = (RadMultiColumnComboBoxElement)this.griditemdisplay.ActiveEditor;
                    serchengineElement.DropDownSizingMode = SizingMode.UpDownAndRightBottom;
                    serchengineElement.DropDownMinSize = new Size(550, 300);
                    serchengineElement.DropDownMaxSize = new Size(550, 300);
                    serchengineElement.EditorControl.MasterTemplate.AutoGenerateColumns = false;
                    serchengineElement.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
                    serchengineElement.AutoSizeDropDownToBestFit = false;
                    serchengineElement.DropDownAnimationEnabled = false;
                    serchengineElement.EditorControl.Columns.Add(new GridViewTextBoxColumn("Stockno"));
                    FilterDescriptor filtercustomername = new FilterDescriptor("Stockno", FilterOperator.Contains, string.Empty);
                    serchengineElement.EditorControl.FilterDescriptors.Add(filtercustomername);

                }
            }

        }​​

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Sep 2015, 10:57 AM
Hello,

Thank you for writing.
 
In order to filter the rows in the popup grid while typing RadMultiColumnComboBoxElement, you should set the AutoFilter property to true and add the appropriate FilterDescriptor. Please refer to the MultiColumnComboBox >> Filtering help article which is quite useful on this topic. I have prepared a sample project for your convenience.

Indeed, the popup grid does not allow editing, grouping, filtering etc. It is supposed to offer just a selection list for the user. If you need to support the mentioned features, you can implement a custom editor and host a RadPopupEditorControl with the desired grid behavior.

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Victor
Top achievements
Rank 1
answered on 11 Nov 2016, 03:35 PM
How to name the columns in Gridviewmulticolumn?
1
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Nov 2016, 12:47 PM
Hello Victor,

Thank you for writing.  

When the editor for a GridViewMultiComboBoxColumn is initialized, you can change the names of the columns in the popup grid by specifying the HeaderText property for the column. Here is a sample code snippet demonstrating how to change the header name for the first column illustrated in the attached screenshot: 
this.radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;

private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadMultiColumnComboBoxElement mccbEl = e.ActiveEditor as RadMultiColumnComboBoxElement ;
    if (mccbEl != null)
    {
        mccbEl.EditorControl.Columns[0].HeaderText = "My header";
    }
}

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

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Gh Reza
Top achievements
Rank 1
answered on 29 Mar 2020, 09:55 PM

Hi Dear !

I have a Form with radGridView with two column Category and Product.( ComboBox Data Column)

I want when user select Category , Product ComboBox Cell When Show and Open, List a Filtered Product by selected Category.

this is need Fill datasource at runtime when user select product. 

How can i do this ?

Thanks a lot

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Mar 2020, 04:51 AM
Hello, Reza,

Please refer to the following KB article which demonstrates how to implement the popular 'cascading combos' scenario where the range of options available in a drop-down list of a combo column depends on the choice made by the end-user in another combo column for the same row: https://www.telerik.com/support/kb/winforms/gridview/details/cascading-comboboxes-in-radgridview 

I believe that it would fit your scenario.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
GridView
Asked by
T S
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Victor
Top achievements
Rank 1
Gh Reza
Top achievements
Rank 1
Share this question
or