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

Auto-dropdown GridViewComboBoxColumn on single-click?

5 Answers 1380 Views
GridView
This is a migrated thread and some comments may be shown as answers.
joseph_korn
Top achievements
Rank 1
joseph_korn asked on 15 May 2008, 09:20 PM
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..

5 Answers, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 17 May 2008, 03:54 PM
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
0
Marina Vision
Top achievements
Rank 1
answered on 14 Jun 2010, 07:56 AM
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


0
Martin Vasilev
Telerik team
answered on 17 Jun 2010, 04:04 PM
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.
0
Jimmy
Top achievements
Rank 1
answered on 27 Jun 2018, 01:39 PM

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

 

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Jun 2018, 08:24 AM
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.
Tags
GridView
Asked by
joseph_korn
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Marina Vision
Top achievements
Rank 1
Jimmy
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or