Autocomplete on textbox column

9 posts, 0 answers
  1. Martin
    Martin avatar
    2 posts
    Member since:
    Mar 2013

    Posted 27 Jan 2014 Link to this post

    Just wondering, is it possible to implement some autocomplete functionality on gridviewtextboxcolumn.
    This will be great advantage.

    Regars,
    Martin
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 28 Jan 2014 Link to this post

    Hi Martin,

    Thank you for writing. 

    You can achieve auto complete functionality in a GridViewTextBoxColumn cell by changing the cell editor with a custom one, holding RadAutoCompleteBoxElement. Attached you can find a sample of this. 

    I hope this helps. 

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Marco
    Marco avatar
    87 posts
    Member since:
    Apr 2011

    Posted 12 Oct in reply to Stefan Link to this post

    Hi,

    I'm currently looking for the same thing but it looks like the link to the sample is broken.

    Is it possible to update it ?

  5. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 13 Oct Link to this post

    Hello Marco,

    Thank you for writing.  

    When I download the project, then remove all references and add them anew by using the DLLs from the installation on my machine, everything works as expected. Please refer to the attached gif file demonstrating the behavior on my end with the latest version.
     
    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.
  6. Marco
    Marco avatar
    87 posts
    Member since:
    Apr 2011

    Posted 13 Oct in reply to Dess Link to this post

    Hello Dess,

    In fact my problem is about downloading the project files. I get 404 error page when I click on the link (same about your picture file).

    I will check it on another computer and network.

    Best regards

    Marco

  7. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 13 Oct Link to this post

    Hello Marco, 

    Thank you for writing back. 

    I have attached the sample project again. Could you please try to download it now? 

    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.
  8. Marco
    Marco avatar
    87 posts
    Member since:
    Apr 2011

    Posted 13 Oct in reply to Dess Link to this post

    Hello Dess,

    It's always the same on my personnal or work computer. All links give me the same error. 

    I attach a picture of the error page.

  9. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 14 Oct Link to this post

    Hello Marco, 

    Thank you for writing back. 

    Currently, we are experiencing an issue with the attachments in the public forums. Please excuse us for the inconvenience caused.The problem will be addressed as soon as possible.

    You can find below the complete code snippet that the project contains: 
    private void Form1_Load(object sender, EventArgs e)
    {
        this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
     
        this.radGridView1.DataSource = this.customersBindingSource;
        radGridView1.EditorRequired += radGridView1_EditorRequired;
        radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;
        radGridView1.AutoSizeRows = true;
    }
     
    void radGridView1_EditorRequired(object sender, Telerik.WinControls.UI.EditorRequiredEventArgs e)
    {
        if (radGridView1.CurrentColumn.Name == "Country")
        {
            e.Editor = new MyAutoCompleteEditor();
        }
    }
     
    void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
    {
        if (e.ActiveEditor is MyAutoCompleteEditor)
        {
            DataTable uniqueCountries = nwindDataSet.Tables[0].DefaultView.ToTable(true, "Country");
            MyAutoCompleteEditor editor = (MyAutoCompleteEditor)e.ActiveEditor;
            RadAutoCompleteBoxElement element = (RadAutoCompleteBoxElement)editor.EditorElement;
            element.Delimiter = ' ';
            element.AutoCompleteDataSource = uniqueCountries;
            element.AutoCompleteDisplayMember = "Country";
            element.AutoCompleteValueMember = "Country";
        }
    }

    class MyAutoCompleteEditor : RadTextBoxControlEditor
    {
        protected override Telerik.WinControls.RadElement CreateEditorElement()
        {
            return new RadAutoCompleteBoxElement();
        }
     
        public override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
        {
            RadAutoCompleteBoxElement element = this.EditorElement as RadAutoCompleteBoxElement;
             
            if (element.IsAutoCompleteDropDownOpen)
            {
                return;
            }
     
            base.OnKeyDown(e);
        }
         
    }

    I hope this information helps. If you have any additional questions, please let me know.

    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.
  10. Marco
    Marco avatar
    87 posts
    Member since:
    Apr 2011

    Posted 17 Oct in reply to Dess Link to this post

    Hello Dess

    Thanks for the snippet. I have found all the information I needed to implement this behavior in my project.

    Hope that's the issue about the attachments will be resolved soon.

    Best regards

    Marco

Back to Top
UI for WinForms is Visual Studio 2017 Ready