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

Problem with GridDateTimeColumn filtering

0 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Iker Llanos
Top achievements
Rank 1
Iker Llanos asked on 21 Jul 2011, 03:56 PM
First excuse my english. I have a grid in my page and a method in a WCF Data Service:

<telerik:RadGrid ID="rgDepartaments" runat="server" AllowPaging="true" AllowSorting="true"
    AllowFilteringByColumn="true" PageSize="10" AllowMultiRowEdit="true" OnItemCreated="rgDepartaments_ItemCreated">
    <MasterTableView DataKeyNames="IdDepartament" ClientDataKeyNames="IdDepartament" CommandItemDisplay="Bottom">
        <Columns>           
            <telerik:GridBoundColumn UniqueName="Departament" DataField="Departamento" DataType="System.String">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn UniqueName="UpdateDate" DataField="UpdateDate"
                DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy HH:mm}" HeaderStyle-Width="150px">
            </telerik:GridDateTimeColumn>           
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <DataBinding Location="~/DesktopModules/Comun/Services/DepartmentSvc.svc" SelectCountMethod="TotalDepartments">
            <DataService TableName="Departament" />
        </DataBinding>
    </ClientSettings>
</telerik:RadGrid>

[WebGet]
public int TotalDepartments(string where)
{
    return String.IsNullOrEmpty(where) ? this.CurrentDataSource.Department.Count() : this.CurrentDataSource.Department.Where(where).Count();
}

I have 2 problems:
1-  When the TotalDepartments is executed with a where condition having a UpdateDate filter I get the following error: Edm.DateTime and Edm.String are not compatible types.

2.- The grid contains 5 records with UpdateDate (21/07/2011 --> 21st July 2011). When I try to filter through UpdateDate width 16/07/2011 and "major than" I get no record (all records must have been returned). By if I filter with 16/07/2001 and "less than" I get all the records (no record must have been returned).

Where is the problem?, Maybe the culture or the DataFormatString?. I've been looking in Google but I can get no answer.

Thanks in advance.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Iker Llanos
Top achievements
Rank 1
Share this question
or