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

ShowDropDown for combo in GridView

5 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hasanain
Top achievements
Rank 1
Hasanain asked on 18 Jul 2012, 03:35 PM
Hi! Is there any way to simulate the ShowDropDown method of radDropDownList in the DropDownListEditor in the grid? thanks.

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 20 Jul 2012, 01:37 PM
Hello,

Thank you for writing.

Yes, RadGridView has a GridViewComboBoxColumn which cell's default editor is RadDropDownListEditor. More information regarding this column can be found here: http://www.telerik.com/help/winforms/gridview-columns-gridviewcomboboxcolumn.html
 
All the best,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Hasanain
Top achievements
Rank 1
answered on 23 Jul 2012, 05:37 PM
Thank you Stefan for your answer but I can not find the ” ShowDropDown” method. excuse me!
0
Accepted
Stefan
Telerik team
answered on 26 Jul 2012, 11:03 AM
Hi Hasanain,

The method to open drop down is in the EditorElement of the RadDropDownListEditor. To use it, a cell must be placed in EditMode and then in the CellEditorInitialized event you will be able to access its RadDropDownListEditorElement and the desired method. Here is a sample where upon button click, I am placing the cell on the second row of a combo column in edit mode and I am opening its drop down:
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadDropDownListEditor editor = this.radGridView1.ActiveEditor as RadDropDownListEditor;
    if (editor != null)
    {
 
        ((RadDropDownListEditorElement)((RadDropDownListEditor)this.radGridView1.ActiveEditor).EditorElement).ShowPopup();
    }
}
 
void radButton1_Click(object sender, EventArgs e)
{
    radGridView1.Rows[1].Cells["combo"].BeginEdit();
}

I hope this helps.

All the best,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Hasanain
Top achievements
Rank 1
answered on 26 Jul 2012, 12:15 PM
Yes ! but why it's somuch difficult? why the name of the method is different? any way, thank you.
0
Stefan
Telerik team
answered on 31 Jul 2012, 10:24 AM
Hi Hasanain,

I am glad that I could help.

The idea of CellEditorInitialized event is to allow you to have a one central place where you can access and modify the various editors that RadGridView cells use. As to the name of the method, I agree that it should be consistent. Basically, both call the same ShowPopup method of RadDropDownListElement, just the one in RadDropDownList is called ShowDropDown for convenience of the users.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Hasanain
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Hasanain
Top achievements
Rank 1
Share this question
or