Telerik Forums
UI for ASP.NET Core Forum
3 answers
424 views

Hello,

I am experiencing a problem applying culture to the validation messages in my editable grid. I experience the exact same problem as in the following demo:  https://demos.telerik.com/aspnet-core/grid/globalization?culture=fr-FR

 

As a user I would expect the validation message to be localized but they don't seem to be.

To reproduce,

  1. Set the culture to anything other then english,
  2. Edit a row,
  3. Empty the "Name" column,
  4. click out of the textbox to activate validation and notice that the validation message displayed is in english.

 

Any help on this will be greatly appreciated!

Thank you

Tsvetomir
Telerik team
 answered on 10 Sep 2019
1 answer
1.1K+ views

I create a disabled DropDownList with the following code:

<kendo-dropdownlist for="FreezeVM.Year" class="form-control"
                    datatextfield="Text"
                    datavaluefield="Value"
                    height="290"
                    enable="false"
                    bind-to="Model.YearList">
</kendo-dropdownlist>

Based on another DropDownList I change the value of this list:

function onTargetTypeChange(e) {
    var targetValue = this.value();
    var currentYear = new Date().getFullYear();
    var yearDrop = $("#FreezeVM\\.Year").data("kendoDropDownList");
    if (targetValue === "6" || targetValue === "7") {
        yearDrop.value(currentYear + 1);
    }
    else {
        yearDrop.value(currentYear);
    };
};

 

The change is reflected on the UI, but not on the underlying Model which still has the old value. As soon as I enable the DropDownList everything works fine. What I expect is that the value gets changed no matter if the dropdown is enabled or disabled.

Regards
Heiko

 

Petar
Telerik team
 answered on 09 Sep 2019
3 answers
884 views

Hi,

i am using ASP.NET Core with a KENDO Grid which calls a Razor Page handler.

For performance reasons, the Grid is pageable, filterable and sortable.

Now we want the DataSourceRequest on the server to directly filter the MongoDB query. I am using "AsQueryable()" on the IMongoCollection, which i thought works nicely with the KENDO DataSourceResult method. 

But the speed of the MongoDB query is always slow. It does not matter if i filter the grid for just one result or if i display all results (paged).

 

Is this the correct way to use KENDO Grid with MongoDB "database-filtering"?

 

I am using the following code:

Client

@(Html.Kendo().Grid<PolicyAudit>().Name("PolicyGrid")
            .Pageable()
            .Navigatable()
            .Sortable()
            .Filterable()
            .Columns(columBuilder =>
            {
                columBuilder.Bound(x => x.Orga);
                columBuilder.Bound(x => x.Operation);
                columBuilder.Bound(x => x.Ressource);
                columBuilder.Bound(x => x.TimeStamp);
                columBuilder.Bound(x => x.UserEmail);
                columBuilder.Bound(x => x.AccessResult);
            })
            .DataSource(source => source.Ajax()
                .Read("PolicyOverview", "Policy", new { handler = "ReadPolicyAudits" })))

 

Server

public async Task<IActionResult> OnPostReadPolicyAudits([DataSourceRequest]DataSourceRequest request)
        {
            var access = new PolicyDataAccess();
            var col = access.GetCollection<PolicyAudit>("MetaPolicyCollection");
 
            var data = await col.AsQueryable().ToDataSourceResultAsync(request);
            return new JsonResult(data);
        }
Tsvetomir
Telerik team
 answered on 09 Sep 2019
5 answers
1.5K+ views

Hello,

I use a template column to have a Kendo style Checkbox in my grid but this is not bind to the underlying boolean value...
with a "normal" Checkbox this is possible with JavaScript but the tsyled Checkbox uses a Label for Styling... (see Picture)

how to do this with the styled checkboxes?

 

Viktor Tachev
Telerik team
 answered on 09 Sep 2019
3 answers
358 views
How do we call Kendo UI ajax calls like read,update etc.. in razor pages. The demo is for MVC. Appreciate if you can provide one with an example.
Joel
Top achievements
Rank 1
Iron
 answered on 06 Sep 2019
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
746 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
665 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
516 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
184 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
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?