Grid view with Multi column combo box

4 posts, 0 answers
  1. T S
    T S avatar
    5 posts
    Member since:
    Jul 2015

    Posted 16 Sep 2015 Link to this post

    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);

                    }
                }

            }​​

     

     

     

     

     

  2. Dess
    Admin
    Dess avatar
    1602 posts

    Posted 18 Sep 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Victor
    Victor avatar
    2 posts
    Member since:
    Mar 2016

    Posted 11 Nov in reply to Dess Link to this post

    How to name the columns in Gridviewmulticolumn?
  5. Dess
    Admin
    Dess avatar
    1602 posts

    Posted 15 Nov Link to this post

    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.
Back to Top