ShowDropDown for combo in GridView

6 posts, 1 answers
  1. Hasanain
    Hasanain avatar
    4 posts
    Member since:
    Aug 2012

    Posted 18 Jul 2012 Link to this post

    Hi! Is there any way to simulate the ShowDropDown method of radDropDownList in the DropDownListEditor in the grid? thanks.
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 20 Jul 2012 Link to this post

    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 >>
  3. Hasanain
    Hasanain avatar
    4 posts
    Member since:
    Aug 2012

    Posted 23 Jul 2012 Link to this post

    Thank you Stefan for your answer but I can not find the ” ShowDropDown” method. excuse me!
  4. Answer
    Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 26 Jul 2012 Link to this post

    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 >>
  5. Hasanain
    Hasanain avatar
    4 posts
    Member since:
    Aug 2012

    Posted 26 Jul 2012 Link to this post

    Yes ! but why it's somuch difficult? why the name of the method is different? any way, thank you.
  6. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 31 Jul 2012 Link to this post

    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 >>
Back to Top