Add Combo Box to Specific Cell in the GridView Control

2 posts, 0 answers
  1. James
    James avatar
    11 posts
    Member since:
    Sep 2011

    Posted 20 Apr 2012 Link to this post

    Assume I only want to add a combo box editor to the cell located in the second row, second column of a gridview control.  Am I able to do this?  If so, what code would I use for this?  All of the other cells in this control will have a text edit box editor.


    Thanks.




  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 21 Apr 2012 Link to this post

    Hi James,

    Thank you for writing.

    A convenient event for replacing the default editor with a custom one is the EditorRequired event of RadGridView. Here is a sample snippet:
    void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
    {
        if (radGridView1.CurrentCell.RowIndex == 1 && radGridView1.CurrentCell.ColumnIndex == 1)
        {
            e.Editor = new RadDropDownListEditor();
        }
    }

    More information regarding editors in RadGridView can be found in the following help section: http://www.telerik.com/help/winforms/gridview-editors-using-custom-editors.html.

    I hope that you find the provided information useful.

    Regards,
    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