Hi to all,
I'm trying to use the basic filtering of the grid but in my GridDateTimeColumn i'm getting this error when trying to filter the column:
The argument types 'Edm.DateTimeOffset' and 'Edm.String' are incompatible for this operation. Near greater than or equals expression, line 6, column 21.
Here is my code:
HTML
<%@ Page Title="Logs" Language="C#" MasterPageFile="~/Platform/Site.Platform.Master" AutoEventWireup="true" CodeBehind="LogsList.aspx.cs" Inherits="UI.LogsList" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div style="height: 50px;">
<asp:Label runat="server" ID="LabelPageTitle" CssClass="h3 GridTitle">Logs</asp:Label>
</div>
<div>
<!-- Define the datasource -->
<ef:EntityDataSource ID="EntityDataSourceLogs" runat="server" ContextTypeName="Common.EntityModels.PlatformDB" ConnectionString="name=PlatformDB"
DefaultContainerName="PlatformDB"
EnableUpdate="False" EnableDelete="False" EnableInsert="False"
EntitySetName="Logs" OrderBy="it.CreatedDateTime desc" />
<!-- Define the grid -->
<telerik:RadGrid runat="server" ID="RadGridLogs" AllowPaging="True" AllowSorting="true" Height="578" DataSourceID="EntityDataSourceLogs">
<GroupingSettings CaseSensitive="false"></GroupingSettings>
<MasterTableView DataKeyNames="Id" AutoGenerateColumns="False" AllowPaging="true"
AllowAutomaticInserts="false" ClientDataKeyNames="Id" AllowFilteringByColumn="true" >
<Columns>
<telerik:GridBoundColumn DataField="Id" HeaderText="Id" SortExpression="Id" UniqueName="Id" Visible="false" MaxLength="100">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="CreatedDateTime" HeaderText="Date" SortExpression="CreatedDateTime" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" PickerType="DatePicker" DataFormatString="{0:d}" AutoPostBackOnFilter="true" CurrentFilterFunction="GreaterThanOrEqualTo" ShowFilterIcon="false" EnableTimeIndependentFiltering="true">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" UniqueName="Description" Visible="true" MaxLength="100" ItemStyle-Width="100" FilterControlWidth="300px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Server" HeaderText="Server" SortExpression="Server" UniqueName="Server" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Application" HeaderText="Application" SortExpression="Application" UniqueName="Application" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Module" HeaderText="Module" SortExpression="Module" UniqueName="Module" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Function" HeaderText="Function" SortExpression="Function" UniqueName="Function" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true">
<Selecting AllowRowSelect="False"></Selecting>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="Bottom" PageSizeControlType="RadComboBox"></PagerStyle>
</telerik:RadGrid>
</div>
</asp:Content>
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace UI
{
public partial class LogsList : DetailBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
The entity value of the field is:
namespace Common.EntityModels
{
using System;
using System.Collections.Generic;
public partial class Log
{
public long Id { get; set; }
public System.DateTimeOffset CreatedDateTime { get; set; }
public short Type { get; set; }
public string Description { get; set; }
public string Server { get; set; }
public string Application { get; set; }
public string Module { get; set; }
public string Function { get; set; }
public Nullable<int> TenantId { get; set; }
public Nullable<int> UserId { get; set; }
public string SessionId { get; set; }
}
}
And in SQL is:
[CreatedDateTime] DATETIMEOFFSET (7) NOT NULL
Can you tell me what i'm doing wrong??
Thanks.
I'm trying to use the basic filtering of the grid but in my GridDateTimeColumn i'm getting this error when trying to filter the column:
The argument types 'Edm.DateTimeOffset' and 'Edm.String' are incompatible for this operation. Near greater than or equals expression, line 6, column 21.
Here is my code:
HTML
<%@ Page Title="Logs" Language="C#" MasterPageFile="~/Platform/Site.Platform.Master" AutoEventWireup="true" CodeBehind="LogsList.aspx.cs" Inherits="UI.LogsList" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div style="height: 50px;">
<asp:Label runat="server" ID="LabelPageTitle" CssClass="h3 GridTitle">Logs</asp:Label>
</div>
<div>
<!-- Define the datasource -->
<ef:EntityDataSource ID="EntityDataSourceLogs" runat="server" ContextTypeName="Common.EntityModels.PlatformDB" ConnectionString="name=PlatformDB"
DefaultContainerName="PlatformDB"
EnableUpdate="False" EnableDelete="False" EnableInsert="False"
EntitySetName="Logs" OrderBy="it.CreatedDateTime desc" />
<!-- Define the grid -->
<telerik:RadGrid runat="server" ID="RadGridLogs" AllowPaging="True" AllowSorting="true" Height="578" DataSourceID="EntityDataSourceLogs">
<GroupingSettings CaseSensitive="false"></GroupingSettings>
<MasterTableView DataKeyNames="Id" AutoGenerateColumns="False" AllowPaging="true"
AllowAutomaticInserts="false" ClientDataKeyNames="Id" AllowFilteringByColumn="true" >
<Columns>
<telerik:GridBoundColumn DataField="Id" HeaderText="Id" SortExpression="Id" UniqueName="Id" Visible="false" MaxLength="100">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="CreatedDateTime" HeaderText="Date" SortExpression="CreatedDateTime" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" PickerType="DatePicker" DataFormatString="{0:d}" AutoPostBackOnFilter="true" CurrentFilterFunction="GreaterThanOrEqualTo" ShowFilterIcon="false" EnableTimeIndependentFiltering="true">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" UniqueName="Description" Visible="true" MaxLength="100" ItemStyle-Width="100" FilterControlWidth="300px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Server" HeaderText="Server" SortExpression="Server" UniqueName="Server" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Application" HeaderText="Application" SortExpression="Application" UniqueName="Application" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Module" HeaderText="Module" SortExpression="Module" UniqueName="Module" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Function" HeaderText="Function" SortExpression="Function" UniqueName="Function" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true">
<Selecting AllowRowSelect="False"></Selecting>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="Bottom" PageSizeControlType="RadComboBox"></PagerStyle>
</telerik:RadGrid>
</div>
</asp:Content>
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace UI
{
public partial class LogsList : DetailBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
The entity value of the field is:
namespace Common.EntityModels
{
using System;
using System.Collections.Generic;
public partial class Log
{
public long Id { get; set; }
public System.DateTimeOffset CreatedDateTime { get; set; }
public short Type { get; set; }
public string Description { get; set; }
public string Server { get; set; }
public string Application { get; set; }
public string Module { get; set; }
public string Function { get; set; }
public Nullable<int> TenantId { get; set; }
public Nullable<int> UserId { get; set; }
public string SessionId { get; set; }
}
}
And in SQL is:
[CreatedDateTime] DATETIMEOFFSET (7) NOT NULL
Can you tell me what i'm doing wrong??
Thanks.