Auto-dropdown GridViewComboBoxColumn on single-click?

6 posts, 1 answers
  1. joseph_korn
    joseph_korn avatar
    21 posts
    Member since:
    Apr 2007

    Posted 15 May 2008 Link to this post

    I am wondering if it is possible to have a GridViewComboBoxColumn that when clicked on, will automatically dropdown the list of choices for you to choose from (This saves one click when you are clicking many comboboxes in one go)? I imagine you would run the dropdown code in the CellBeginEdit event.. I am just not sure exactly how to accomplish this..
  2. Answer
    Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 17 May 2008 Link to this post

    Hi Joseph,

    Thank you for the question.

    You can show the drop down on first click by using RadComboBoxEditor's ShowDropDown() method in the CellEditorInitialized event. Please, review the following code-block:
     
    private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)  
    {  
        if ((this.radGridView1.ActiveEditor != null) &&   
            (this.radGridView1.ActiveEditor is RadComboBoxEditor))  
        {  
            (this.radGridView1.ActiveEditor as RadComboBoxEditor).ShowDropDown();     
        }  

    I hope this helps. If you have other questions, do not hesitate to contact me again.

     
    Greetings,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Marina Vision
    Marina Vision avatar
    5 posts
    Member since:
    Dec 2009

    Posted 14 Jun 2010 Link to this post

    This command doesn't work anymore:
    (this.grdItems.ActiveEditor as RadComboBoxEditor).ShowDropDown(); 
    I'm using Releases Q1-2010.
    Was it replaced with a new command?

    Thanks,
    Marina


  4. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 17 Jun 2010 Link to this post

    Hi Marina Vision,

    Thank you for writing.

    In Q1 2010 release we have introduced a different editor structure and the implementation of the Auto-DropDown should be done in a different way, namely, by with using a custom combo-box editor. Please consider the following code snippet:
    void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
    {
        if (e.EditorType == typeof(RadComboBoxEditor))
        {
            e.Editor = new CustomComboEditor();
        }
    }
    class CustomComboEditor : RadComboBoxEditor
    {
        public override void BeginEdit()
        {
            base.BeginEdit();
            ((RadComboBoxEditorElement)this.EditorElement).ShowPopup();
        }
    }

    Let me know if you have any additional questions.

    Kind regards,
    Martin Vasilev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  5. Jimmy
    Jimmy avatar
    9 posts
    Member since:
    May 2017

    Posted 27 Jun 2018 Link to this post

    I am trying to use a GridViewComboBoxColoumn in my Winform Application and I want to eliminate the 3 clicks it takes to select a value in the combo. 

    Can I subscribe to an event and automatically show the combo?  

     

    Thanks for your help,

    Jimmy Voegele

     

     

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4130 posts

    Posted 28 Jun 2018 Link to this post

    Hello, Jimmy,   

    In order to show the popup immediately after activating the editor you can use the following code snippet when handling the RadGridView.CellEditorInitialized event: 

    private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        RadDropDownListEditor ddl = e.ActiveEditor as RadDropDownListEditor;
        if (ddl!=null)
        {
            RadDropDownListEditorElement el = ddl.EditorElement as RadDropDownListEditorElement;
            el.ShowPopup();
        }
    }

    In addition, you can subscribe to the CellClick event and force entering edit mode: 
               GridViewComboBoxColumn comboCol = new GridViewComboBoxColumn("CategoryName");
               comboCol.DataSource = this.categoriesBindingSource;
               comboCol.ValueMember = "CategoryID";
               comboCol.DisplayMember = "CategoryName";
               comboCol.FieldName = "CategoryID";
               comboCol.Width = 200;
               this.radGridView1.Columns.Add(comboCol);      
     
    private void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
           {
               if (e.Column.HeaderText =="CategoryName")
               {
                   this.radGridView1.BeginEdit();  
               }
           }

    Thus, only with a single click, you can activate the editor and show the drop down.

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

    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