RadGrid Filter Templates With EntityDataSource

10 posts, 0 answers
  1. Dallas Gaddis
    Dallas Gaddis avatar
    4 posts
    Member since:
    Jan 2010

    Posted 17 Jun 2010 Link to this post

    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> 
  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 22 Jun 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James
    James avatar
    9 posts
    Member since:
    Nov 2007

    Posted 01 Dec 2010 Link to this post

    I have exactly this same issue with EntityDataSource. Did this get resolved?
  5. Dallas Gaddis
    Dallas Gaddis avatar
    4 posts
    Member since:
    Jan 2010

    Posted 01 Dec 2010 Link to this post

    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
  6. James
    James avatar
    9 posts
    Member since:
    Nov 2007

    Posted 01 Dec 2010 Link to this post

    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.
  7. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 06 Dec 2010 Link to this post

    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.
  8. Sagar
    Sagar avatar
    1 posts
    Member since:
    May 2009

    Posted 06 Jan 2011 Link to this post

    Having exactly same issue. Any idea when 'between' filter for EntityDataSource will be supported?
  9. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 11 Jan 2011 Link to this post

    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.
  10. Nagendra
    Nagendra avatar
    1 posts
    Member since:
    Mar 2011

    Posted 22 Mar 2011 Link to this post

    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
  11. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 25 Mar 2011 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017