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

RadFilter -- Show Contains as Default

8 Answers 215 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Bill Swartz
Top achievements
Rank 1
Bill Swartz asked on 19 Apr 2011, 12:33 AM
In RadFilter's compare operator dropdown, Is there a way to display Contains as Default instead of Equal to for string data types .

8 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Apr 2011, 12:44 PM
Hi Bill,

To set the default expression to Contains you can use the code snippet below:
C#:
protected void RadFilter1_ItemCommand(object sender, RadFilterCommandEventArgs e) 
    if (e.CommandName == RadFilter.AddExpressionCommandName) 
    
        e.Canceled = true
        RadFilterContainsFilterExpression item = new RadFilterContainsFilterExpression("ColumnUniqueName"); 
        (e.ExpressionItem as RadFilterGroupExpressionItem).Expression.AddExpression(item); 
        RadFilter1.RecreateControl(); 
    
}

Try it out and let me know how it goes.

Regards,
Pavlina
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
Bill Swartz
Top achievements
Rank 1
answered on 19 Apr 2011, 04:38 PM
Hi Pavlina,


Getting Error  "Object reference not set to an instance of an object." on the line RadFilter1.RecreateControl(); 


Thanks
0
Bill Swartz
Top achievements
Rank 1
answered on 20 Apr 2011, 12:38 AM
Hi Pavlina,

   Do you've any updates on this.

thanks
0
Pavlina
Telerik team
answered on 20 Apr 2011, 11:04 AM
Hello Bill,

Please find attached to this message a sample working project which handles the desired functionality. Examine it and see if it works as expected or if I am leaving something out.

All the best,
Pavlina
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
Bill Swartz
Top achievements
Rank 1
answered on 20 Apr 2011, 05:57 PM
Hi Pavlina,
   I've 2 issues.

    1.Filter drop down shows contains as default on the screen for string datatype but when i click apply    nothing     works.         I've     attached     one.jpg     sample file herewith.
   2. While adding multiple fields, for example from your sample add country, "Contains" doesnt show as default, instead shows equal to as default
        and on top clicking apply does nothing.
0
Bill Swartz
Top achievements
Rank 1
answered on 20 Apr 2011, 06:33 PM

Hi Pavlina,

I updated Radfilter tag with  FilterContainerID="RadGrid1" , it works but different than your code.
Without updating FilterContainerID Filter shows only 2 column names in drop down but adding FilterContainerID
shows all the columns in the drop down and shows "contains" as default for all the column. If i add a date column, that also shows "contains" as default and the appln crashes. Can you provide me an example using Orders table with int, string,date datatypes. I need this feature to work for all datatypes.

Thanks
0
Pavlina
Telerik team
answered on 26 Apr 2011, 04:27 PM
Hi Bill,

It is important to note that, if there are any field editors defined in the aspx code, these will be overridden by the settings applied by the user at runtime. Thus, the final filter expression would not reflect the pre-defined filter field editors. Please check out the help article below for more information:
http://www.telerik.com/help/aspnet-ajax/filter-basics.html

Regards,
Pavlina
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
Campus Labs
Top achievements
Rank 1
answered on 05 May 2011, 04:55 PM
Bill, I worked on a similar feature a while ago. Here's the forum post with the details: http://www.telerik.com/community/forums/aspnet-ajax/filter/default-filter-function-for-custom-field-editor.aspx#1392723

Hope that helps!
Tags
Filter
Asked by
Bill Swartz
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Bill Swartz
Top achievements
Rank 1
Campus Labs
Top achievements
Rank 1
Share this question
or