Autocomplete with the GridViewComboBoxColumn or GridViewMultiColumnCombo

11 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. UI for WinForms is Visual Studio 2017 Ready
  4. 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!
  5. 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?
  6. Stefan
    Admin
    Stefan avatar
    2890 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 >>
  7. 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.









  8. Stefan
    Admin
    Stefan avatar
    2890 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 >>
  9. 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'
  10. Dess
    Admin
    Dess avatar
    1609 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.
     
  11. 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..
  12. Dess
    Admin
    Dess avatar
    1609 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.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready