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

filter property of grid view

3 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
salini
Top achievements
Rank 1
salini asked on 15 Nov 2010, 02:50 PM
can i have a list of values on a filter property like equals
actually i want to have a drop down on a filter which will be having some list of values from that column from which the client can select and get the results on the grid.
thanks in advance

3 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 18 Nov 2010, 12:56 PM
Hi salini,

Thank you for writing to us.

If I understand you properly, you want to replace the default editor with a drop down list containing the filtering values. You can achieve that by using the EditorRequired event:

private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
    if (this.radGridView1.CurrentRow is GridViewFilteringRowInfo)
    {
        RadDropDownListEditor dropDownEditor = new RadDropDownListEditor();
        RadDropDownListEditorElement editorElement = dropDownEditor.EditorElement as RadDropDownListEditorElement;
        editorElement.ValueMember = "ID";
        editorElement.DisplayMember = "Name";
        editorElement.DataSource = Data.GetDummyEmployees();
        e.Editor = dropDownEditor;
    }
}

If you need further assistance, do not hesitate to write us back.

Greetings,
Svett
the Telerik team
See What's New in RadControls for WinForms in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
0
salini
Top achievements
Rank 1
answered on 26 Nov 2010, 10:34 AM
hi
i am using q3 version of telerik
i want to know that can i set custom values( like result from a stored procedure) to the showcolumnheaderproperty of a grid view.
i dont want the filter column header property to have distinct values from the grid view column rather i want it  to bind to a stored procedure
please help!
0
Svett
Telerik team
answered on 01 Dec 2010, 05:41 PM
Hi salini,

As I mentioned, you can replace the default editor by handling the EditorRequired event. You can refer to my previous post for additional information. If you want to change the data source of GridViewComboBoxColumn cells, you should use the CellEditorInitialized event: 
private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    if ((this.radGridView1.CurrentCell is GridFilterCellElement))
    {
        if (this.radGridView1.CurrentCell.ColumnInfo.Name == "ColumnName")
        {
            RadDropDownListEditor editor = this.radGridView1.ActiveEditor as RadDropDownListEditor;
            RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement;
 
            element.DataSource = GetEditorFilterDataSource();
            element.DisplayMember = "Display";
            element.ValueMember = "Value";
        }
    }
}


Kind regards,
Svett
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
GridView
Asked by
salini
Top achievements
Rank 1
Answers by
Svett
Telerik team
salini
Top achievements
Rank 1
Share this question
or