Telerik Forums
UI for ASP.NET Core Forum
12 answers
1.3K+ views

I"m trying to filter a grid that is bound to many fields including a few that are DateTime. My filter works great until I try to do one on a datetime type field then it errors out. What operator can I use on a datetime? Here's the error and the settings for the filter.

Message"The binary operator GreaterThanOrEqual is not defined for the types 'System.DateTime' and 'System.String'."string

$("#Grid").data("kendoGrid").dataSource.filter({
            logic: "or",
            filters: [
                {
                    field: "DateEntered",
                    operator: "gte",
                    value: searchValue
                },
                {
                    field: "DateEntered",
                    operator: "lte",
                    value: searchValue
                },

Thanks!

Craig

Georgi
Telerik team
 answered on 04 Sep 2019
2 answers
521 views

Hi,

Is Kendo UI works with asp .Net core 2.0 ? 

If yes, can anyone have any demo on this. As, I am trying to use Kendo UI  for my asp .net core 2.0 project and I am getting some issue there.

Chris
Top achievements
Rank 1
 answered on 03 Sep 2019
4 answers
1.0K+ views

Hi

  For some unknown reason, the intellisense suddenly stops working.

  When i create a new asp.net core project using telerik's wizard, it is working ok.

  I am using VS2017 with asp.net core R2 2019.

<environment include="Development">
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" href="~/lib/kendo-ui/styles/kendo.common-bootstrap.min.css" />
    <link rel="stylesheet" href="~/lib/kendo-ui/styles/kendo.metro.min.css" />

 

Martin
Telerik team
 answered on 02 Sep 2019
1 answer
5.3K+ views

Hi,

  I am using DataTables from DataTables in TabStrip.

  I figure i faced the same problem as mentioned here: datatable jquery - table header width not aligned with body width

  There was a solution mentioned in the blog that works for Bootstrap Tab:

// If table is in the tab, you need to adjust headers when tab becomes visible.
// For example, for Bootstrap Tab plugin:
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e){
   $($.fn.dataTable.tables(true)).DataTable().columns.adjust();});

 

   How can i do that for telerik TabStrip?

Here is my TabStrip in cshtml:

<div class="col-md-9 k-content wide">
    @(Html.Kendo().TabStrip()
                .Name("tabstrip")
                .Animation(animation =>
                      animation.Open(effect =>
                          effect.Fade(FadeDirection.In)))
                  .Items(tabstrip =>
                  {
                      tabstrip.Add().Text("OEE")
                          .Selected(true)
                          .Content(@<text>
                            </text>);
 
                        tabstrip.Add().Text("System Performance")
                            .Content(@<text>
                                <div class="container">
                                    <div class="row">
                                        <div class="col-5">
                                            <table id="systemPerfTable" class="table table-striped table-bordered" cellspacing="0">
                                                <thead>
                                                    <tr>
                                                        <th>Item</th>
                                                        <th>Value</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <th scope="row">Lot Elapsed Timestamp</th>
                                                        <td id="lotElapsedTimestamp">1/1/1900 00:00:00</td>
                                                    </tr>
                                                    <tr>
                                                        <th scope="row">Lot Submission Timestamp</th>
                                                        <td id="lotSubmissionTimestamp">1/1/1900 00:00:00</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </text>);
                   })
    )
</div>

 

Here is the script:

<script>
        $("#systemPerfTable").DataTable({
            scrollY: "500px",
            scrollCollapse: true,
            paging: false,
            searching: false,
            ordering: false,
            info: false
        });
</script>
Petar
Telerik team
 answered on 30 Aug 2019
8 answers
1.3K+ views
I have a grid that I would like to be filtered based on a button that a user clicks on a website.  I have went through much of the documentation, but I am unable to find a way to filter without using a string. I would like to pass in a value. Is there something that I am missing here.  
@(Html.Kendo().Grid<Item>()
                    .Name("grid").Scrollable(c => c.Enabled(true).Height(1000))
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Filter(f=>f.Add(a=>a.Status).IsEqualTo(""))
                        .Read(read => read.Action("Products_Read", "Controller"))
                        .PageSize(20)
                        )
Georgi
Telerik team
 answered on 30 Aug 2019
9 answers
119 views

Hi I have the code and result below, but Auto Complete show not fund any thing i missing or got it wrong here?

@(Html.Kendo().AutoComplete()
.Name("ceaSearch")
.HtmlAttributes(new { style = "width:100%" })
.DataTextField("salesperson_name")
.MinLength(1)
.DataSource(source =>{
    source.Read(read =>
    {
        read.Url("https://data.gov.sg/api/action/datastore_search")
        .Data("getCEAData");
    })
    .ServerFiltering(true)
    .Custom()
    .Schema(schema => schema
        .Data("records")
        .Type("json")
        .Model(model =>
        {
            model.Id("salesperson_nam");
            model.Field("registration_no", typeof(string));
            model.Field("estate_agent_name", typeof(string));
            model.Field("estate_agent_license_no", typeof(string));
        })
    );
}).Template("<span>#: records.salesperson_name#</span>"))

 

 

function getCEAData() {

    var value = $("#ceaSearch").data("kendoAutoComplete").value();
    return {
        resource_id: 'a41ce851-728e-4d65-8dc5-e0515a01ff31', // the resource id
        q: value
    };
}

 

The API returned data below. but Autocomplate show not found

 

{"help": "https://data.gov.sg/api/3/action/help_show?name=datastore_search", "success": true, "result": {"resource_id": "a41ce851-728e-4d65-8dc5-e0515a01ff31", "fields": [{"type": "int4", "id": "_id"}, {"type": "text", "id": "salesperson_name"}, {"type": "text", "id": "registration_no"}, {"type": "text", "id": "registration_start_date"}, {"type": "text", "id": "registration_end_date"}, {"type": "text", "id": "estate_agent_name"}, {"type": "text", "id": "estate_agent_license_no"}, {"type": "int8", "id": "_full_count"}, {"type": "float4", "id": "rank"}], "q": "merita", "records": [{"registration_end_date": "2019-12-31", "estate_agent_license_no": "L3008536D", "salesperson_name": "MERITA LOUISE TIN GUEK PING (DENG YUEPING) (MERITA LOUISE TIN)", "registration_no": "R000662B", "rank": 0.0706241, "_full_count": "2", "registration_start_date": "2015-11-03", "estate_agent_name": "LANDPLUS PROPERTY NETWORK PTE LTD", "_id": 30808}, {"registration_end_date": "2019-12-31", "estate_agent_license_no": "L3008536D", "salesperson_name": "MERITA LOUISE TIN GUEK PING (DENG YUEPING) (MERITA LOUISE TIN)", "registration_no": "R000662B", "rank": 0.0706241, "_full_count": "2", "registration_start_date": "2015-11-03", "estate_agent_name": "LANDPLUS PROPERTY NETWORK PTE LTD", "_id": 32886}], "_links": {"start": "/api/action/datastore_search?q=merita&resource_id=a41ce851-728e-4d65-8dc5-e0515a01ff31", "next": "/api/action/datastore_search?q=merita&offset=100&resource_id=a41ce851-728e-4d65-8dc5-e0515a01ff31"}, "total": 2}}

Ivan Danchev
Telerik team
 answered on 29 Aug 2019
1 answer
320 views

Telerik UI for ASP.NET Core not working on Razor page Core 2.0

To replicate:

Create New Project -> .NET Core -> ASP.NET Core Web Application

Select -> Web Application (ASP.NET Core 2.0)

Added services.AddKendo(); to Startup.cs

Added @addTagHelper, etc .  to _ViewImports.cshtml

Added link and script to _Layout.cshtml

Added @using Kendo.Mvc.UI and @(Html.Kendo().DatePicker().Name("my-picker")) to target page.

Encountered error showed in title. 

Nikolay
Telerik team
 answered on 28 Aug 2019
3 answers
1.6K+ views

I am using the example from: https://demos.telerik.com/aspnet-core/pdfviewer/index

No matter what PDF file I put in the code I get the message "PDF file fails to process".  If I use the dialog on the PDF Viewer and go to the exact same PDF file it opens correctly.  Any idea what I am missing?

From Layout.cshtml:

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - TestPDFApp</title>
    <script src="~/js/site.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/jszip.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/kendo.all.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/kendo.aspnetmvc.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" href="~/lib/kendo-ui/styles/kendo.common.min.css" />
    <link rel="stylesheet" href="~/lib/kendo-ui/styles/kendo.rtl.min.css" />
    <link rel="stylesheet" href="~/lib/kendo-ui/styles/kendo.bootstrap.min.css" />
    <link href="~/css/site.css" rel="stylesheet" />
</head>

 

From my View:

<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.js"></script>
<script>
    window.pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.worker.js';
</script>
<div id="example">
    @(Html.Kendo().PDFViewer().Name("pdfviewer")
                //.PdfjsProcessing(pdf => pdf.File(Url.Content("~/wwwroot/PDF/Issue Definitions.pdf")))
                .PdfjsProcessing(pdf => pdf.File(Url.Content("https://demos.telerik.com/kendo-ui/content/web/pdfViewer/sample.pdf")))
                .Height(1200)
    )
</div>
<style>
    html body #pdfviewer {
        width: 100% !important;
    }
</style>

Petar
Telerik team
 answered on 27 Aug 2019
2 answers
117 views

Is there a way to make a column cell in the grid editable when the user clicks the create button on the toolbar but to make the same column cell read only when the user tries to edit the record?  I want the user to be able to add new records but not be able to change the values in a specific field when editing the row.

I can use the beforeEdit function to determine if it is in new or update state but not sure what to do from here.

function beforeEdit(e) {
        if (!e.model.isNew()) {
            alert("Edit");
        }
        else {
            alert("New");
        }
    }

I am using Visual Studio 2017, Net Core 2.1 Telerik 2019.2.619

Thanks.

Rich

Nikolay
Telerik team
 answered on 26 Aug 2019
7 answers
3.2K+ views

I have an angular grid which uses a GridDataResult posting back to an API controller in my .netcore project with a DataSourceRequest parameter.

The first column of my grid has a Guid, declared in a model both server and client side.

When I try filter on this column the server throws an exception:

"Provided expression should have string type".

I have searched both this forum and the MVC forum to try apply a server-side request filter to no avail.

How should this be handled?

Daniel Blendea
Top achievements
Rank 1
 answered on 23 Aug 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?