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

how to go through radfilter data text field

9 Answers 204 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
bharat veer
Top achievements
Rank 1
bharat veer asked on 25 Apr 2011, 06:37 PM
Hi,
i have a radfilter.
how can i go through the data text field in the radfilter, that are generated to build a query
to filter the data.
i mean is there any way to go through the data in controls that controls are generated
in Radfilter to build the query.

9 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 28 Apr 2011, 10:14 AM
Hello Bharat,

In order to get the expression tree built by the RadFilter control,  you can use the ApplyFilterExpressions event:
protected void RadFilter1_ApplyExpressions(object sender, RadFilterApplyExpressionsEventArgs e)
{
    RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
    provider.ProcessGroup(e.ExpressionRoot);
    //the filter expressions are contained in provider.Result
}
Please note that the corresponding to your data source RadFilter query provider should be used.

I hope this helps.

All the best,
Mira
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
bharat veer
Top achievements
Rank 1
answered on 03 May 2011, 07:50 PM
Sir,
thank you for your response.
scanario is this, my radgrid is bound by the ORM datasource. and attached to radfilter (rfGridFilter here in my code) through its
FilterContainerID property.
a date field also contained in orm datasource and displayed in datagrid. now when radfilter is used with this date field and any wrong format is given in Radfilter generated datatextfield for date. and a button is clicked then below event is fired.
protected void rbApplyFilter_Click(object sender, EventArgs e)
        {           
                rfGridFilter.FireApplyCommand();
                rgModuleGrid.Rebind();          
          }


then this below mentioned error is occured on    this code of line rfGridFilter.FireApplyCommand(); 
Telerik.OpenAccess.RT.sql.SQLException: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.next()
   at OpenAccessRuntime.Relational.RelationalStorageManager.executeCount(RelationalCompiledQuery cq, Object[] param)



 


how can i sort out this problem.
0
Mira
Telerik team
answered on 05 May 2011, 01:37 PM
Hello Bharat,

Based on the supplied information, it is hard to determine what is causing the error.
Could you please send us the code blocks you use for getting the expression built by the RadFilter and for applying it to the datasource?

Thank you in advance for the cooperation.

Greetings,
Mira
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
bharat veer
Top achievements
Rank 1
answered on 26 May 2011, 01:42 PM
Hi,
I have a Radfilter. its FilterContainerID property refer to a grid. Grid is bound through ORM, two columns one are bound to Grid
suach as EmpName(string type) and JoiningDate (datetime type).

now we want to filter data through the Radfilter. i click Radfilter AddExpression button. then it shows two field such as
EmpName and JoinDate. when JoinDate is selected a DateTimePicker control is generated to enter the date.

I enter some character or other thing instead of a proper date in this DateTimePicker control.
then click a button and this event is fired--
     protected void rbApplyFilter_Click(object sender, EventArgs e)
        {
            rfGridFilter.FireApplyCommand(); //exception occurs here
            rgModuleGrid.Rebind();
        }


Telerik.OpenAccess.RT.sql.SQLException: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.next()
   at OpenAccessRuntime.Relational.RelationalStorageManager.executeCount(RelationalCompiledQuery cq, Object[] param)

on this code of line rfGridFilter.FireApplyCommand(); as u can see

my question is that is there any way before FireApplyCommand method that it could be checked
that any proper format date is entered or not in Radfilter generated Datetime picker control or not.
and message could be given to user
0
Mira
Telerik team
answered on 30 May 2011, 11:13 AM
Hello Bharat,

When an invalid date is entered in the RadDateTimePicker, its value automatically is set to 1/1/0001 12:00:00 AM (the minimal allowed date).
You can see how to access and modify the filter expression here.

I hope this helps.

Regards,
Mira
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
piet
Top achievements
Rank 1
answered on 24 Nov 2011, 09:39 PM
Hello Mira,

When using the  RadFilterSqlQueryProvider and using a datetime field in the Radfilter the result of the provider.Result call is for example:

([date)] >= '23-11-2011 16:00:00')

For SQL however one expects:
([date)] >= CONVERT(DATETIME, '2011-11-23 16:00:00', 102))

This is probably causing the error mentioned by Bharat.

The other providers of the Radfilter also don't give a result that could be used in a where clause of an SQL statement. Do you have a solution to this?
One would expect that a custom sqlprovider (with base class RadFilterSqlQueryProvider) would be available for e.g. ms-sql and mysql.

Thanks
Piet

0
piet
Top achievements
Rank 1
answered on 24 Nov 2011, 09:39 PM
Hello Mira,

When using the  RadFilterSqlQueryProvider and using a datetime field in the Radfilter the result of the provider.Result call is for example:

([date)] >= '23-11-2011 16:00:00')

For SQL however one expects:
([date)] >= CONVERT(DATETIME, '2011-11-23 16:00:00', 102))

This is probably causing the error mentioned by Bharat.

The other providers of the Radfilter also don't give a result that could be used in a where clause of an SQL statement. Do you have a solution to this?
One would expect that a custom sqlprovider (with base class RadFilterSqlQueryProvider) would be available for e.g. ms-sql and mysql.

Thanks
Piet

0
piet
Top achievements
Rank 1
answered on 24 Nov 2011, 09:40 PM
Hello Mira,

When using the  RadFilterSqlQueryProvider and using a datetime field in the Radfilter the result of the provider.Result call is for example:

([date)] >= '23-11-2011 16:00:00')

For SQL however one expects:
([date)] >= CONVERT(DATETIME, '2011-11-23 16:00:00', 102))

This is probably causing the error mentioned by Bharat.

The other providers of the Radfilter also don't give a result that could be used in a where clause of an SQL statement. Do you have a solution to this?
One would expect that a custom sqlprovider (with base class RadFilterSqlQueryProvider) would be available for e.g. ms-sql and mysql.

Thanks
Piet

0
Mira
Telerik team
answered on 29 Nov 2011, 08:41 AM
Hello Piet,

I have answered your post about the same issue in the How to get SQL statement from Radfilter forum thread.
In order to avoid duplicate posts, I suggest that we continue the communication in the other thread.

Best wishes,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
General Discussions
Asked by
bharat veer
Top achievements
Rank 1
Answers by
Mira
Telerik team
bharat veer
Top achievements
Rank 1
piet
Top achievements
Rank 1
Share this question
or