Autocomplete with the GridViewComboBoxColumn or GridViewMultiColumnCombo

14 posts, 0 answers
  1. Artan
    Artan avatar
    4 posts
    Member since:
    Apr 2012

    Posted 19 Apr 2012 Link to this post

     How can I get the combo in the grid to allow the users to at least type the first letter of whatever selection they need to make? At the momemnt I've got a working combo, it just doesn't allow any typing at all - is there a property I need to set?

  2. Holger Boskugel
    Holger Boskugel avatar
    24 posts
    Member since:
    Apr 2012

    Posted 20 Apr 2012 Link to this post

    Hello Artan,

    how about the "AutoCompleteMode" property? Or do you need a ComboBox that excepts also new values? Than see my other thread here and solution.


    Regards

    Holger
    --
    http://vbwebprofi.de
  3. Artan
    Artan avatar
    4 posts
    Member since:
    Apr 2012

    Posted 20 Apr 2012 Link to this post

    Hi Holger,

    If I add a GridViewtextBoxColumn or GridViewCalculatorColumn to the gridview then I can write on their cells but if I insert
    GridViewComboBoxColumn or GridViewMultiColumnCombo I can't write on their cells! 
    I want to write because of filtering not add a new value to existing list.

    If I use radMultiColumnComboBox out of the radgridview its working good but on GridView not for me!

    Many thanks!
  4. Artan
    Artan avatar
    4 posts
    Member since:
    Apr 2012

    Posted 20 Apr 2012 Link to this post

    That problem I try to describe by Screen Shots.
    I can't solve that problem until now!

    Can anyone show me how to solve it?
  5. Stefan
    Admin
    Stefan avatar
    2906 posts

    Posted 21 Apr 2012 Link to this post

    Hello Artan,

    Thank you for writing.

    In order to be able to type in the GridViewMultiComboBoxColumn editor, you need to set the DropDownStyle of the column to DropDown:
    col.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;

    I hope that you find this information useful.

    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  6. Artan
    Artan avatar
    4 posts
    Member since:
    Apr 2012

    Posted 22 Apr 2012 Link to this post

    Hi Stefan and thank you very much,
    it's working now.

    I have another request!

    Is there possible to filter after writing three letters then show the data?

    my scenario:
    1) I'm filling with data my GridViewMultiComboBoxColumn from SQL Server Procedure. 
    2) I don't want to see every records, because its working slow then I want to fill my GridViewMultiComboBoxColumn after I type three letters to the cell.









  7. Stefan
    Admin
    Stefan avatar
    2906 posts

    Posted 24 Apr 2012 Link to this post

    Hi Artan,

    Attached to my post you can find a sample demonstrating how to achieve the desired functionality. Basically, I am subscribing to the TextChanged event of the editor, and if there are three letters typed in, I am adding the appropriate FilterDescriptor to the underlying grid.

    Off topic, I would like to kindly ask you to open a new thread for questions not related to the one discussed in the current forum thread. This will help our community to easily find the desired information.

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  8. Kweku
    Kweku avatar
    2 posts
    Member since:
    Oct 2012

    Posted 25 Sep 2014 Link to this post

    How can the combo box in the gridview autocomplete be 'Contains' not 'Starts with'
  9. Dess
    Admin
    Dess avatar
    2180 posts

    Posted 25 Sep 2014 Link to this post

    Hello Kweku,

    Thank you for writing.

    In order to change the suggestion mechanism to filter the items using "Contains" mode you need to set the DropDownListElement.AutoCompleteSuggest.SuggestMode to SuggestMode.Contains. For this purpose you should subscribe to the CellEditorInitialized event and modify the aforementioned property:
    private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor;
        if (editor!=null)
        {
            RadDropDownListEditorElement el = editor.EditorElement as RadDropDownListEditorElement;
            el.AutoCompleteMode = AutoCompleteMode.Suggest;
            el.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;
        }
    }

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  10. BHk
    BHk avatar
    3 posts
    Member since:
    Dec 2014

    Posted 01 Dec 2014 in reply to Stefan Link to this post

    My Gridview in ComboBox in First time Data dispay for Sometimes later display...approx 5-7 second time later than display ComboBox in Data.Why this Possoble??please give me Satisfaction Answer..
  11. Dess
    Admin
    Dess avatar
    2180 posts

    Posted 04 Dec 2014 Link to this post

    Hello Vaghela,

    Thank you for writing.

    Following the provided brief description, I have tried to reproduce the problem on my end with the latest version but without any success. Please find attached a sample gif file, illustrating the load time in milliseconds for the drop down. It takes less than a second. Here is my sample code snippet:
    public Form1()
    {
        InitializeComponent();
     
        DataTable dt = new DataTable();
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Title", typeof(string));
        dt.Columns.Add("Type", typeof(int));
        Random rand = new Random();
        for (int i = 0; i < 10; i++)
        {
            dt.Rows.Add(i, "Title" + i, rand.Next(0, 2000));
        }
     
        this.radGridView1.AutoGenerateColumns = false;
     
        GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("ID column");
        decimalColumn.FieldName = "Id";
        this.radGridView1.MasterTemplate.Columns.Add(decimalColumn);
     
        GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn("Title column");
        textBoxColumn.FieldName = "Title";
        this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn);
     
        DataTable comboSource = new DataTable();
        comboSource.Columns.Add("Id", typeof(int));
        comboSource.Columns.Add("Description", typeof(string));
        for (int i = 0; i < 2000; i++)
        {
            comboSource.Rows.Add(i, "Type" + i);
        }
        GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn("Type column");
        comboColumn.DataSource = comboSource;
        comboColumn.ValueMember = "Id";
        comboColumn.DisplayMember = "Description";
        comboColumn.FieldName = "Type";
        this.radGridView1.Columns.Add(comboColumn);
     
        this.radGridView1.DataSource = dt;
        this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
     
        this.radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;
    }
     
    Stopwatch sw;
     
    private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
       if (e.Column.Name == "Type")
        {
            RadDropDownListEditor ddl = e.ActiveEditor as RadDropDownListEditor;
            if (ddl != null)
            {
                sw = new Stopwatch();
                sw.Start();
                RadDropDownListEditorElement element = ddl.EditorElement as RadDropDownListEditorElement;
                element.PopupOpened -= element_PopupOpened;
                element.PopupOpened += element_PopupOpened;
            }
        }
    }
    private void element_PopupOpened(object sender, EventArgs e)
    {
        sw.Stop();
        RadMessageBox.Instance.StartPosition = FormStartPosition.CenterScreen;
        RadMessageBox.Show("Load Time: " + sw.ElapsedMilliseconds);
    }

    Feel free to modify it on a way to reproduce the issue you are facing and get back to me with it so I can investigate the precise case and assist you further. Thank you in advance. 

    I am looking forward to your reply.

    Regards,
    Desislava
    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.

     
  12. Denius
    Denius avatar
    17 posts
    Member since:
    Oct 2015

    Posted 18 Oct in reply to Dess Link to this post

    Hi everyone,

    I have a problem with the GridViewComboBoxColumn control.

    I added

    ddl2.DropDownStyle = RadDropDownStyle.DropDown;    

    ddl2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

    On Windows 10 the search is fine, but the problem is when the build-to-server version

    > Windows server r2 2012 <

    search does not work.

    Like not to see the code line ddl2.DropDownStyle = RadDropDownStyle.DropDown;

    I checked the versions of the references that everything is fine they are the same.

  13. Denius
    Denius avatar
    17 posts
    Member since:
    Oct 2015

    Posted 18 Oct in reply to Denius Link to this post

    this is solution maybe helps somebody

    in event CellEditorInitialized radGridView

    //filtering dropdownlist
                if (sender is GridViewEditManager)
                    if (((GridViewEditManager)sender).GridViewElement.CurrentColumn.Name == "Skills" || ((GridViewEditManager)sender).GridViewElement.CurrentColumn.Name == "Next Question")
                    {
                        RadDropDownListEditor listEditor = this.radGridAnswer.ActiveEditor as RadDropDownListEditor;

                        if (listEditor == null)
                        {
                            return;
                        }

                        RadDropDownListEditorElement editorElementSearch = listEditor.EditorElement as RadDropDownListEditorElement;
                        editorElementSearch.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                        editorElementSearch.DropDownStyle = RadDropDownStyle.DropDown;
                    }

  14. Dess
    Admin
    Dess avatar
    2180 posts

    Posted 20 Oct Link to this post

    Hello, Goran,  

    Thank you for writing.  

    Both of the approaches (setting the AutoCompleteMode/DropDownStyle property of the GridViewComboBoxColumn or for the RadDropDownListEditorElement in the CellEditorInitialized event) are correct and they are supposed to work as expected. However, it seems that when you specify the properties at column's level it doesn't work for you. That is why I have prepared a sample project for your reference. Feel free to use the approach with handling the CellEditorInitialized event. 

    However, if you are still experiencing any difficulties with the column's approach it would be greatly appreciated if you can specify the exact steps how to reproduce the problem. Alternatively, feel free to submit a support ticket where you can provide a sample project demonstrating the undesired behavior. Thus, we would be able to investigate the precise case and assist you further. Thank you in advance.

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

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top