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
0
Hi Bill,
To set the default expression to Contains you can use the code snippet below:
C#:
Try it out and let me know how it goes.
Regards,
Pavlina
the Telerik team
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
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
Do you've any updates on this.
thanks
0
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
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.
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
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
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!
Hope that helps!