Combobox GridView Column

2 posts, 1 answers
  1. Simeon
    Simeon avatar
    6 posts
    Member since:
    Mar 2012

    Posted 11 Apr 2012 Link to this post

    Hi,
    Congrats on your lovely gridview control.
    That is exactly what many people needed and i'm sure that you will continuing with many new features.
    In my view it will be great to implement the full combobox functionality  on the gridview column. I mean the filtering and autocomplete functionality as well. May be there is a way but i can not find it, so please let me know.
    Regards,
    Simeon
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 16 Apr 2012 Link to this post

    Hi Simeon,

    Thank you for writing.

    Both of the desired functionalities are supported by the RadDropDownListEditor in RadGridView. In order to enable the auto complete functionality, you need to set the DropDownStyle to DropDown and also to set the desired AutoCompleteMode:
    comboColumn.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;
    comboColumn.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

    In regards to the filtering of the drop down list, this can be achieved by setting the Filter property of RadDropDownListEditorElement. You can access this element of the editor in the CellEditorInitialized event of RadGridView:
    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor;
        if (editor != null)
        {
            RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement;
            element.Filter = FilterMethod;
        }
    }
     
    private bool FilterMethod(RadListDataItem itemToFilter)
    {
        return itemToFilter.Text.ToLower().Contains("b");
    }

    I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us.
     
    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