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

RadGrid Filter Templates With EntityDataSource

9 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dallas Gaddis
Top achievements
Rank 1
Dallas Gaddis asked on 17 Jun 2010, 03:25 PM
I'm having trouble implementing a solution similar to the example from the second grid on the following page to do a "between" filter on a date column in a RadGrid.

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx

As far as I can tell I have implemented all the relevant stuff from the example and the only difference is I'm using an EntityDataSource instead of a SqlDataSource.  However, when I select a date from either box I get the following error.

The datetime literal value '2010-06-02' is not valid. Near line 6, column 17.

 

I used the small example below to reproduce the error.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
    <div> 
        <telerik:RadGrid ID="gvWorkItem" runat="server" AutoGenerateColumns="False" DataSourceID="edsWorkItem"   
            GridLines="None" AllowFilteringByColumn="True">  
            <MasterTableView DataKeyNames="WorkItemID" DataSourceID="edsWorkItem">  
                <Columns> 
                    <telerik:GridBoundColumn DataField="WorkItemID" DataType="System.Int32" HeaderText="#"   
                        ReadOnly="True" SortExpression="WorkItemID" UniqueName="WorkItemID" /> 
                    <telerik:GridBoundColumn DataField="Description" HeaderText="Description"   
                        SortExpression="Description" UniqueName="Description" /> 
                    <telerik:GridBoundColumn DataField="DueDate" DataType="System.DateTime"   
                        HeaderText="Due Date" SortExpression="DueDate" UniqueName="DueDate">  
                        <FilterTemplate> 
                            <telerik:RadDatePicker ID="FromDatePicker" runat="server"   
                                ClientEvents-OnDateSelected="FromDatePicker_DateSelected" /><br /> 
                            <telerik:RadDatePicker ID="ToDatePicker" runat="server"   
                                ClientEvents-OnDateSelected="ToDatePicker_DateSelected" /> 
                            <telerik:RadScriptBlock ID="RadCodeBlock1" runat="server">  
                                <script type="text/javascript">  
                                    function FromDatePicker_DateSelected(sender, args) {  
                                        var tableView =   
                                            $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");  
                                        var ToPicker =   
                                            $find('<%# ((GridItem)Container).FindControl("ToDatePicker").ClientID %>');  
                                        var fromDate = FormatSelectedDate(sender);  
                                        var toDate = FormatSelectedDate(ToPicker);  
                                        tableView.filter("DueDate", fromDate + " " + toDate, "Between");  
                                    }  
                                    function ToDatePicker_DateSelected(sender, args) {  
                                        var tableView =   
                                            $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");  
                                        var FromPicker =   
                                            $find('<%# ((GridItem)Container).FindControl("FromDatePicker").ClientID %>');  
                                        var fromDate = FormatSelectedDate(FromPicker);  
                                        var toDate = FormatSelectedDate(sender);  
                                        tableView.filter("DueDate", fromDate + " " + toDate, "Between");  
                                    }  
                                    function FormatSelectedDate(picker) {  
                                        var date = picker.get_selectedDate();  
                                        var dateInput = picker.get_dateInput();  
                                        var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date,   
                                            dateInput.get_displayDateFormat());  
                                        return formattedDate;  
                                    }  
                                </script> 
                            </telerik:RadScriptBlock> 
                        </FilterTemplate> 
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
        <asp:EntityDataSource ID="edsWorkItem" runat="server" ConnectionString="name=WorkDataEntities"   
            DefaultContainerName="WorkDataEntities" EntitySetName="WorkItems" /> 
    </div> 
    </form> 
</body> 
</html> 

9 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 22 Jun 2010, 12:58 PM
Hi Dallas,

I tried to reproduce the described issue, but to no avail. Could you please send us a small runnable project which demonstrates the issue. You could open a formal support ticket from your Telerik account and attach a ZIP file there.Thus we will be able to we debug the project and provide you with more to-the-point answer.

Kind regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
James
Top achievements
Rank 1
answered on 01 Dec 2010, 03:43 PM
I have exactly this same issue with EntityDataSource. Did this get resolved?
0
Dallas Gaddis
Top achievements
Rank 1
answered on 01 Dec 2010, 04:03 PM
Unfortunately not.  After submitting a support ticket I was told this is a known issue.  I also just tried it again with 2010.3.1109 and it still doesn't work.

Dallas
0
James
Top achievements
Rank 1
answered on 01 Dec 2010, 04:09 PM
Thanks for the quick response. I spent the better part of a day trying to get this to work.

Telerik, if there is any way for me to do a "between" filter using EntityDataSource please let me know. Right now I am stuck with using duplicate columns and having to set greater than and less than on each one.
0
Radoslav
Telerik team
answered on 06 Dec 2010, 12:27 PM
Hello James,

Unfortunately the RadGrid's filtering does not support "Between" FilterFunction when the RadGrid is bound to the EntityDataSource. To achieve the desired functionality you could try using the RadFilter control. On the following links you could find more information and live demo of the RadFilter control:

http://demos.telerik.com/aspnet-ajax/filter/examples/integration/defaultcs.aspx?product=grid
http://www.telerik.com/help/aspnet-ajax/filter-basics.html
http://www.telerik.com/help/aspnet-ajax/grid-filtering-with-radfilter.html

Kind regards,
Radoslav
the Telerik team
Browse the vast support resources we have to jumpstart 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
Sagar
Top achievements
Rank 1
answered on 06 Jan 2011, 04:28 PM
Having exactly same issue. Any idea when 'between' filter for EntityDataSource will be supported?
0
Radoslav
Telerik team
answered on 11 Jan 2011, 12:42 PM
Hi Sagar,

Unfortunately we cannot commit with a deadline yet. We do not have immediate plans to add such functionality. This feature is hard to implement and would require lots of research in order to find the best solution in terms of performance and usability. Please accept our apologies for not being more specific.

Best wishes,
Radoslav
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
Nagendra
Top achievements
Rank 1
answered on 22 Mar 2011, 11:45 PM
Hi ,

Do we have any code fix for the error

The datetime literal value '2010-06-02' is not valid. Near line 6, column 17.



This error comes when using a Between Fliter on a date column.

Thanks
Nag
0
Radoslav
Telerik team
answered on 25 Mar 2011, 01:11 PM
Hi Nagendra,

Unfortunately the RadGrid still does not support "Between" FilterFunction when the RadGrid is bound to the EntityDataSource. Like I said in my previous post we do not have immediate plans to add such functionality. To achieve the desired functionality you could try using the RadFilter control.

Regards,
Radoslav
the Telerik team
Tags
Grid
Asked by
Dallas Gaddis
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
James
Top achievements
Rank 1
Dallas Gaddis
Top achievements
Rank 1
Sagar
Top achievements
Rank 1
Nagendra
Top achievements
Rank 1
Share this question
or