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

Autocomplete with the GridViewComboBoxColumn or GridViewMultiColumnCombo

15 Answers 289 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Artan
Top achievements
Rank 1
Artan asked on 20 Apr 2012, 01:55 AM
 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?

15 Answers, 1 is accepted

Sort by
0
Holger Boskugel
Top achievements
Rank 2
answered on 20 Apr 2012, 11:33 AM
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
0
Artan
Top achievements
Rank 1
answered on 20 Apr 2012, 12:50 PM
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!
0
Artan
Top achievements
Rank 1
answered on 21 Apr 2012, 12:55 AM
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?
1
Stefan
Telerik team
answered on 21 Apr 2012, 02:33 PM
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 >>
Christian
Top achievements
Rank 1
commented on 28 May 2021, 04:20 AM

Thanks for this! This fixed my issue.
0
Artan
Top achievements
Rank 1
answered on 22 Apr 2012, 11:11 PM
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.









0
Stefan
Telerik team
answered on 24 Apr 2012, 02:49 PM
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 >>
0
Kweku
Top achievements
Rank 1
answered on 25 Sep 2014, 12:21 PM
How can the combo box in the gridview autocomplete be 'Contains' not 'Starts with'
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 Sep 2014, 03:23 PM
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.
 
0
BHk
Top achievements
Rank 1
answered on 01 Dec 2014, 12:22 PM
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..
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Dec 2014, 09:04 AM
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.

 
0
Denius
Top achievements
Rank 1
answered on 18 Oct 2017, 12:45 PM

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.

0
Denius
Top achievements
Rank 1
answered on 18 Oct 2017, 02:42 PM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Oct 2017, 11:35 AM
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.
0
Yousef
Top achievements
Rank 1
answered on 17 Oct 2018, 12:26 AM

Thanks for your helps!

How I can to set the GridViewComboBoxColumn as MyCol.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;

0
Dimitar
Telerik team
answered on 17 Oct 2018, 11:33 AM
Hi Yousef,

You can use the CellEditorInitialized event to access the editor and set the property:
private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    var editor = e.ActiveEditor as RadDropDownListEditor;
    if (editor != null)
    {
        var element = editor.EditorElement as RadDropDownListEditorElement;
        element.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Artan
Top achievements
Rank 1
Answers by
Holger Boskugel
Top achievements
Rank 2
Artan
Top achievements
Rank 1
Stefan
Telerik team
Kweku
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
BHk
Top achievements
Rank 1
Denius
Top achievements
Rank 1
Yousef
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or