GridView with combobox

2 posts, 0 answers
  1. Sa
    Sa avatar
    1 posts
    Member since:
    Feb 2012

    Posted 13 Mar 2012 Link to this post

    Hi 
    i have gridview with a combox column.
    My problem is i want to show combobox when the form is loaded.rather empty cell in the whole column of grid.and it gets the shape of 
    combo when i double clik on it.
    2nd issue is comboxbox got selected on double click.First click enables it and i have to make a 2nd click to drop the list.
    I want to show the combobox droped on first click.

    Help appreciated.
    thnks
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 16 Mar 2012 Link to this post

    Hello,

    Thank you for writing.

    Each cell in RadGridView has an editor, which internally consists of controls/elements (combo box in your case). Having this is mind, the control from the cell will not be displayed until the cell editor is opened. When you click a cell, its editor is initialized and only then the control is accessible. So your requirement to show the cell editor prior initializing it is not possible and not recommended since it will have serious performance impact on your application.

    In regards to your second requirement, when you click a cell and its editor (in your case combo box) is shown, you can manually call the ShowPopup() method of RadDropDownListEditorElement in order to show the drop down:
    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor;
        if (editor != null)
        {
            RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement;
            element.ShowPopup();
        }
    }

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
     
    Greetings,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top