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

Hello,

Can someone please help.

I'm trying to do a simple Inline edit grid which has a datetime field but when clicking update the datetime field which is passed through to the controller has null.  It's actually replicated in the example which Progress supply.  

How do I get a valid date through to the controller? surely this is quite a big issue?  is it a locale problem?

.chtml

}

<div class="row">
<div class="col-xs-18 col-md-12">
@(Html.Kendo().Grid<Sample.Models.OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Freight);
columns.Bound(p => p.OrderDate);
columns.Bound(p => p.ShipName);
columns.Bound(p => p.ShipCity);
                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
})
.Pageable()
.Sortable()
                 .Editable(editable => editable.Mode(GridEditMode.InLine))
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
                    .Batch(true)

                    .Model(model => model.Id(p => p.OrderID))
.Read(read => read.Action("Orders_Read", "Grid"))
.Update(update => update.Action("Orders_Update", "Grid"))
)
)
</div>
</div>

GridController.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Kendo.Mvc.UI;
using Sample.Models;
using Kendo.Mvc.Extensions;

namespace Sample.Controllers
{
    public class GridController : Controller
    {
        public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
        {
            var result = Enumerable.Range(1, 50).Select(i => new OrderViewModel
            {
                OrderID = i,
                Freight = i * 10,
                OrderDate = new DateTime(2016, 9, 15).AddDays(i % 7),
                ShipName = "ShipName " + i,
                ShipCity = "ShipCity " + i
            });

            var dsResult = result.ToDataSourceResult(request);
            return Json(dsResult);
        }
        [AcceptVerbs("Post")]
        public ActionResult Orders_Update([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<OrderViewModel> products)
        {

     //products.OrderDate is null even though I've selected a date on the edit datepicker.
            return Json(products.ToDataSourceResult(request));
        }

    }
}

 

Marcus
Top achievements
Rank 1
 answered on 06 Sep 2019
5 answers
788 views
I am using Kendo Upload for uploading, which works 100%.  But, I just realized the initial file list doesn't work at all.  Can you please provide a working example for .NET core.  I saw in your forum that there was another person who was unsuccessful in an initial file list.  Here is my code:

@(Html.Kendo().Upload()
                      .Name("File")
                      .Async(a => a
                          .AutoUpload(true))
                      .Files(
                      files =>
                      {
                          if (Model.File != null)
                          {
                              files.Add().Name(Model.FileName).Extension(Model.FileExtension).Size((long)Model.FileSize);
                          }
                      }
                      )
                      .Events(e => e.Select("onSelect"))
                      .Multiple(false)
                  )

 

I saw that there was a demo for initial files in mvc but that disappeared in the asp.net core demos.

Thanks


Veselin Tsvetanov
Telerik team
 answered on 06 Sep 2019
3 answers
693 views

In the demo : https://demos.telerik.com/aspnet-core/grid/editing-popup.

there is code shown  as follows in the ProductService.cs:

      public class ProductService : BaseService, IProductService

Where is the code for BaseService and IProduct Service?

Also, more generally, where can I download the sources to all the demos for .net core?

Thanks … Ed

Viktor Tachev
Telerik team
 answered on 05 Sep 2019
5 answers
543 views

I would like to use the tag helper, but I cannot set the initial files like

<files>@Html.Raw(Model.InitialFiles)</files>

I am only able to set them as static HTML list, i.e.

<files><file name="dummy" size="1024" extension=".ext"/></files>

(https://docs.telerik.com/aspnet-core/tag-helpers/editors/upload/overview)

Is it possible to use the tag helper when the file list would be obtained from a model? And how?

 

Ivan Danchev
Telerik team
 answered on 04 Sep 2019
1 answer
194 views
public class EncountersModel : PageModel
  {
      public EncountersModel(IDataAccess dataAccess)
      {
          this.dataAccess = dataAccess;
      }
 
      public IEnumerable<Encounter> Encounters { get; set; }
           
      private readonly IDataAccess dataAccess;
 
      public void OnGet()
      {
          Encounters = dataAccess.GetOpenEncounters();
      }
  }

 

@page
@model SafeUSWeb.Pages.EncountersModel
@{
    ViewData["Title"] = "Encounters";
}
 
<h2>Encounters</h2>
 
@(Html.Kendo().Grid(Model.Encounters)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(c => c.EncounterId).Width(140);
            columns.Bound(c => c.EncounterType).Width(190);
            columns.Bound(c => c.Status);
            columns.Bound(c => c.Organization.OrgName).Width(110);
        })
        .HtmlAttributes(new { style = "height: 380px;" })
  )

 

When I run this I get an error that says - Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR

Viktor Tachev
Telerik team
 answered on 04 Sep 2019
12 answers
1.4K+ 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
548 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.5K+ 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.4K+ 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?