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

Disable Automatic Filtering

2 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raimund
Top achievements
Rank 1
Raimund asked on 12 Feb 2011, 12:34 PM
Hello,

someone knows how to only disable the automatic filtering operation
when performing a filter on a row?

I need to filter a DropDown Column - so i just want to modify the gridview datasource selectcommand

It works - but just the first time and then i get this error
No property or field 'filterExpression' exists in type 'DataRowView' - its because my row is a DropDown

At the gridviews ItemCommand Event im using this code
if (e.CommandName == RadGrid.FilterCommandName)
{
    gvUser.MasterTableView.FilterExpression = ""; //tried with this ... but does not work
    Pair filterPair = (Pair)e.CommandArgument;
    //string s = filterPair.First + ", " + filterPair.Second;
 
    TextBox txtFilterTextBox = (e.Item as GridFilteringItem)[filterPair.Second.ToString()].Controls[0] as TextBox;
    string filterValue = txtFilterTextBox.Text;
 
    srcGv.SelectCommand = "SELECT * FROM [Table1] WHERE [ID] IN (SELECT [ID] FROM [Table2] WHERE [someRow] LIKE '%" + txtFilterTextBox.Text + "%')  ORDER BY [someRow]";
    gvUser.Rebind();
}

i think i just have to disable the automatic filter operation but i cant find where i can disable it ...

Greetings - Raimund

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 16 Feb 2011, 01:29 PM
Hi Raimund,

Have you tried by cancelling the filter command? This prevents the grid from performing its default filtering:
if (e.CommandName == RadGrid.FilterCommandName)
{
     e.Canceled=true;
     //the rest of your code logic
}


Regards,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Raimund
Top achievements
Rank 1
answered on 16 Feb 2011, 06:12 PM

Yay,

it works.

Thank you very much

Tags
Grid
Asked by
Raimund
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Raimund
Top achievements
Rank 1
Share this question
or