Telerik Forums
UI for ASP.NET Core Forum
1 answer
345 views

On my developer machine i have polish language system, but i need to develop all pages in english. I am working with Sample Telerik C# ASP.NET Core MVC Application.
My Razor code is currently:

<p>CurrentCulture: @Html.Raw(System.Globalization.CultureInfo.CurrentCulture.ToString())</p>
<p>CurrentUICulture: @Html.Raw(System.Globalization.CultureInfo.CurrentUICulture.ToString())</p>
@(Html.Kendo().Grid<TelerikAspNetCoreApp2.Models.OrderViewModel>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.OrderID).Filterable(false);

...

    })
    .Groupable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read.Action("Orders_Read", "Grid"))
    )
)

 

HTML result is:

<p>CurrentCulture: en-US</p>
<p>CurrentUICulture: en-US</p>
<div id="grid" name="grid"></div><script>kendo.syncReady(function(){jQuery("#grid").kendoGrid({"groupable":{"enabled":true,"messages":{
"empty":"Przeciągnij nagłówek kolumny i upuść go tutaj aby pogrupować według tej kolumny"}},"columns":[{"title":"Order ID","field":"OrderID","filterable":false,"encoded":true},{"title":"Freight","field":"Freight","filterable":{"messages":{"info":"Pokaż wiersze o wartościach które","isTrue":"prawda","isFalse":"fałsz","filter":"Filtr","clear":"Wyczyść filtr","and":"Oraz","or":"lub","selectValue":"-Wybierz wartość-","value":"Wartość","cancel":"Anuluj","selectedItemsFormat":"{0} selected items"} ....

 

HTML Rendered code contains valid Culture Info=en-US, but Kendo Grid messages are in polish language. How to force Kendo to use English language? Is it also possible to disable this messages? I would like to have short javascript as it is in pure Kendo JS.

Stefan
Telerik team
 answered on 22 May 2017
4 answers
210 views

On the demo page for Server filtering in ASP.NET Core AutoComplete the DataSource property is setup to read products using the GetProducts action of the Home controller:

read.Action("GetProducts", "Home");

 

Anyway you could publish the contents of the GetProducts action?

Ivan Danchev
Telerik team
 answered on 18 May 2017
5 answers
965 views

Hello,

 

why does the following Kendo Menu in ClientTemplate not working?

the menu doesn't open on hover nor on click?

 

@(Html.GpdbKendoGridEdit<SELECT_Standort>("Standort", "Standort_ID")
      .Columns(columns =>
      {
          columns.Bound(c => c.Standort_ID).MinScreenWidth(768).Filterable(false).Sortable(false).IncludeInMenu(false).Width(60);
          columns.Bound(c => c.Standort_ID).Title(" ")
              .ClientTemplate(
                  Html.Kendo().Menu()
                      .Name("menu_#=Standort_ID#")
                      .OpenOnClick(true)
                      .Items(its =>
                      {
                          its.Add()
                              //.SpriteCssClasses("fa fa-tasks")
                              .Text("").Items(nested =>
                              {
                                  nested.Add().Text("test1");
                                  nested.Add().Text("test2");
                                  nested.Add().Text("test3");
                                  nested.Add().Text("test4");
                              });
                      })
                      .ToClientTemplate().ToString()
              )
              .Filterable(false).Sortable(false).IncludeInMenu(false).Width(80);
          columns.Bound(c => c.Strasse).ClientTemplate("#=getRowFormat(Strasse, gelöscht, true)##=(Art == true) ? ' <span class=\"label label-success pull-right\">ZS</span>' : '' ##=(Nichtbetriebe > 0) ? ' <span class=\"label label-danger pull-right\">R</span>' : '' #</br><small>#=getRowFormat(Postleitzahl.concat(' ', Ort), gelöscht, false)#</small>");
          columns.Bound(c => c.Betriebsteil).MinScreenWidth(768).ClientTemplate("#=getRowFormat(Betriebsteil, gelöscht, false)#");
          columns.Bound(c => c.gelöscht).MinScreenWidth(768).Format("{0:dd.MM.yyyy}").Width(110).ClientTemplate("#=getRowFormat(kendo.toString(gelöscht,'dd.MM.yyyy'), gelöscht)#");
      })
      .Editable(e => e.TemplateName("~/Areas/Mitglied/Views/Standorte/_frmStandortEdit.cshtml")
          .Mode(GridEditMode.PopUp).Window(w => w.Title("Standort").Animation(animation => animation
              .Open(open => open.SlideIn(SlideDirection.Left).Duration(500))
              .Close(close => close.SlideIn(SlideDirection.Left).Duration(500).Reverse(true))
              )
          ))
      .DataSource(dataSource => dataSource
          .Ajax()
          .Model(model => model.Id(p => p.Standort_ID))
          .Read(read => read.Action("Standorte_Read", "Standorte"))
          .Update(read => read.Action("Standorte_Update", "Standorte"))
          .Destroy(destroy => destroy.Action("Standorte_Destroy", "Standorte"))
      )
      .AutoBind(false)
      .ClientDetailTemplateId("template")
      )
Viktor Tachev
Telerik team
 answered on 18 May 2017
3 answers
1.5K+ views

Why with upgrade from 2017.1.223 to 2017.2.504 I need to move including of kendo scripts at front of page after body?

In 2017.1.223 I simply include jquery after body (this is unavoidable I guess) and add all other at end of page. But then I upgrade to 2017.2.504 I get "kendo is not defined" (rolling back to 2017.1.223 solves). Also I even did not upgrade bower package in this situation. Just nuget.

so next is _layout.cshtml as to was (working on 2017.1.223 and do not on 2017.2.504 )

and second block works with 2017.2.504

Please tell me if I`am wrong but it is better to shove scripts to the bottom for page rendering performance.

was

<body>
    <environment names="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
    </environment>
    <environment names="Staging,Production">
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery"
                crossorigin="anonymous"
                integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7">
        </script>
    </environment>
 
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">TNPK</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    @if (SignInManager.IsSignedIn(User))
                    {
                        <li><a asp-area="" asp-controller="Codeword" asp-action="Index">Кодовые слова</a></li>
                    }
                </ul>
                @await Html.PartialAsync("_LoginPartial")
            </div>
        </div>
    </nav>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>© @DateTime.Now.Year - TNPK</p>
        </footer>
    </div>
 
    <environment names="Development">
        <script src="~/lib/jquery-ui/jquery-ui.min.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
        <script src="~/lib/kendo-ui/js/jszip.min.js"></script>
        <script src="~/lib/kendo-ui/js/kendo.all.min.js"></script>
        <script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
        <script src="~/lib/kendo-ui/js/cultures/kendo.culture.ru-RU.min.js"></script>
        <script src="~/lib/p-loading/dist/js/p-loading.min.js"></script>
        <script src="~/lib/clipboard/dist/clipboard.min.js"></script>
        <script src="~/js/site.js" asp-append-version="true"></script>
    </environment>
    <environment names="Staging,Production">
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                crossorigin="anonymous"
                integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
        </script>
        <script src="~/lib/kendo-ui/js/jszip.min.js"></script>
        <script src="~/lib/kendo-ui/js/kendo.all.min."></script>
        <script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
        <script src="~/lib/kendo-ui/js/cultures/kendo.culture.ru-RU.min.js"></script>
        <script src="~/lib/p-loading/dist/js/p-loading.min.js"></script>
        <script src="~/lib/clipboard/dist/clipboard.min.js"></script>
        <script src="~/js/site.min.js" asp-append-version="true"></script>
    </environment>
    <script>kendo.culture("ru-RU");</script>
    @RenderSection("Scripts", required: false)
</body>

 

second

<body>
    <environment names="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
    </environment>
    <environment names="Staging,Production">
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery"
                crossorigin="anonymous"
                integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7">
        </script>
    </environment>
    <environment names="Development">
        <script src="~/lib/jquery-ui/jquery-ui.min.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
        <script src="~/lib/kendo-ui/js/jszip.min.js"></script>
        <script src="~/lib/kendo-ui/js/kendo.all.min.js"></script>
        <script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
        <script src="~/lib/kendo-ui/js/cultures/kendo.culture.ru-RU.min.js"></script>
        <script src="~/lib/p-loading/dist/js/p-loading.min.js"></script>
        <script src="~/lib/clipboard/dist/clipboard.min.js"></script>
        <script src="~/js/site.js" asp-append-version="true"></script>
    </environment>
    <environment names="Staging,Production">
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                crossorigin="anonymous"
                integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
        </script>
        <script src="~/lib/kendo-ui/js/jszip.min.js"></script>
        <script src="~/lib/kendo-ui/js/kendo.all.min."></script>
        <script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
        <script src="~/lib/kendo-ui/js/cultures/kendo.culture.ru-RU.min.js"></script>
        <script src="~/lib/p-loading/dist/js/p-loading.min.js"></script>
        <script src="~/lib/clipboard/dist/clipboard.min.js"></script>
        <script src="~/js/site.min.js" asp-append-version="true"></script>
    </environment>
 
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">TNPK</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    @if (SignInManager.IsSignedIn(User))
                    {
                        <li><a asp-area="" asp-controller="Codeword" asp-action="Index">Кодовые слова</a></li>
                    }
                </ul>
                @await Html.PartialAsync("_LoginPartial")
            </div>
        </div>
    </nav>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>© @DateTime.Now.Year - TNPK</p>
        </footer>
    </div>
 
 
    <script>kendo.culture("ru-RU");</script>
    @RenderSection("Scripts", required: false)
</body>
Stefan
Telerik team
 answered on 18 May 2017
1 answer
163 views

Hello,

I have recently started a project using C# MVC and the related Telerik tools both of which I am very new to.  This  project has a requirement of using the ListView widget.  I've taken the base project that is created when you start a new project and I am attempting to convert it to a ListView. 

I've removed the Grid code and replaced it with the code from the ListView Demo after confirming that the project would launch without error.  Below is the code that i have in the index.cshtml file.

<div class="row">
<div class="col-xs-18 col-md-12">
        @(Html.Kendo().ListView<Landing.Models.OrderViewModel>()
    .Name("listView")
    .TagName("div")
    .ClientTemplateId("template")
    .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Orders_Read", "ListView"))
            .PageSize(10)
            )
            .Pageable(pageable => pageable
           .Refresh(true)
           .ButtonCount(5)
           .PageSizes(new[] { 5, 15, 21 })
        )
        )
</div>
</div>

 

I have made a few minor changes but have come across these two issues with running the project.  If I run the project without the debugger no data shows when IE launches.  If I run the project using the IIS Express button in VS2017 I receive the attached error.  I am thinking that I am making a new to the technology mistake but I am uncertain as where to start.  A google search has not turned up any useful information yet.  Has anyone attempted to complete something similar and overcome this error.

Thank you in advance and please let me know if you need additional information concerning my project.

 

Boyan Dimitrov
Telerik team
 answered on 17 May 2017
1 answer
423 views

Hi,

We are using the Grid widget for ASP.NET Core which uses AJAX calls to our ASP.NET Core MVC Controller action methods.

Why would the Read method result in multiple calls to the Controller action method?

 

                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Events(e => e.RequestStart("onRequestStart"))
                    .Read(read => read.Action("ListCars", "CarController"))
                )

Stefan
Telerik team
 answered on 17 May 2017
1 answer
101 views

I have Problem with UI schedule.when I try to enter new Meeting to the room the create event will fire 4 times 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using TelerikScheduler.Entities;
using TelerikScheduler.Services;
using TelerikScheduler.ViewModels;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
 
 
namespace TelerikScheduler.Controllers
{
    public class HomeController : Controller
    {
        private IMeetingData meetingData;
 
        public HomeController(IMeetingData meetingData)
        {
            this.meetingData = meetingData;
        }
 
        public IActionResult Index()
        {
            var model = new HomePageViewModel();
            model.Rooms = meetingData.GetAll();
 
 
            return View(model);
        }
 
        public virtual JsonResult ReadMeeting([DataSourceRequest] DataSourceRequest request)
        {
            return Json(meetingData.GetAll().ToDataSourceResult(request));
        }
 
        public virtual JsonResult DestroyMeeting([DataSourceRequest] DataSourceRequest request, Meeting meeting)
        {
            if (ModelState.IsValid)
            {
               // meetingData.Delete(meeting);
            }
            return Json(new[] { meeting }.ToDataSourceResult(request, ModelState));
        }
 
        public virtual JsonResult CreateMeeting([DataSourceRequest] DataSourceRequest request, Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                meetingData.Insert(meeting, ModelState);
 
            }
            return Json(new[] { meeting }.ToDataSourceResult(request, ModelState));
        }
 
        public virtual JsonResult UpdateMeeting([DataSourceRequest] DataSourceRequest request, Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                //meetingData.Update(meeting);
            }
            return Json(new[] { meeting }.ToDataSourceResult(request, ModelState));
        }
 
 
        public IActionResult Error()
        {
            return View();
        }
    }
}
@using TelerikScheduler.Entities
@using Kendo.Mvc.UI
@using Microsoft.AspNetCore.Mvc.ModelBinding
@model TelerikScheduler.ViewModels.HomePageViewModel
<head>
    <title>Home</title>
</head>
<body>
    <h1>Welcome!</h1>
 
@(Html.Kendo().Scheduler<Meeting>().Name("Meeting").Date(new DateTime(2017, 5, 13))
      .StartTime(new DateTime(2017, 5,13, 7, 00, 00))
      .Views(views=>{
          views.DayView();
          views.AgendaView();
      })
      .Height(600)
      .Timezone("Etc/UTC")
      .Group(group => { group.Resources("Rooms"); group.Date(true); })
      .Resources(resource =>
      {
          resource.Add(m => m.RoomId).Title("Room").Name("Rooms").DataTextField("Text").DataValueField("Value").DataColorField("Color").BindTo(new[] {
              new { Text = "Meeting Room 101", Value = 1, Color = "#6eb3fa" },
              new { Text = "Meeting Room 201", Value = 2, Color = "#f58a8a" }
          });
          resource.Add(m => m.Attendees)
              .Title("Attendees")
              .Multiple(true)
              .DataTextField("Text")
              .DataValueField("Value")
              .DataColorField("Color")
              .BindTo(new[] {
                  new { Text = "Alex", Value = 1, Color = "#f8a398" } ,
                  new { Text = "Bob", Value = 2, Color = "#51a0ed" } ,
                  new { Text = "Charlie", Value = 3, Color = "#56ca85" }
              });
      }).DataSource(d => d
          .Model(m =>
          {
              m.Id(f => f.RecordId);
              m.Field(f => f.Title).DefaultValue("No title");
              m.Field(f => f.Title).DefaultValue("No title");
          })
          .Read("ReadMeeting", "Home")
          .Create("CreateMeeting", "Home")
          .Destroy("DestroyMeeting", "Home")
          .Update("UpdateMeeting", "Home")
          ).BindTo(Model.Rooms).Deferred())
 
 
@section scripts {
    @Html.Kendo().DeferredScripts()
}
 
 
 
</body>
</html>

 

 

Dimitar
Telerik team
 answered on 16 May 2017
1 answer
239 views
I am using Telerik UI Scheduler for asp.net core Project.I am using WebApi to bind data and insert new meeting to the room but I have 2 problems are:

 1. insert is called twice when I insert new Item. 
 2. update and delete methods are bound to Post and they are not calling corresponded  do delete of add operation.

html view
 
    @(Html.Kendo().Scheduler<Meeting>().Name("scheduler").Date(new DateTime(2017, 5, 13))
          .StartTime(new DateTime(2017, 5,13, 7, 00, 00))
          .Editable(true)
          .Views(views=>{
              views.DayView();
              views.AgendaView();
          })
          .Height(600)
          .Timezone("Etc/UTC")
          .Group(group => { group.Resources("Rooms"); group.Date(true); })
          .Resources(resource =>
          {
              resource.Add(m => m.RoomId).Title("Room").Name("Rooms").DataTextField("Text").DataValueField("Value").DataColorField("Color").BindTo(new[] {
                  new { Text = "Meeting Room 101", Value = 1, Color = "#6eb3fa" },
                  new { Text = "Meeting Room 201", Value = 2, Color = "#f58a8a" }
              });
              resource.Add(m => m.Attendees)
                  .Title("Attendees")
                  .Multiple(true)
                  .DataTextField("Text")
                  .DataValueField("Value")
                  .DataColorField("Color")
                  .BindTo(new[] {
                      new { Text = "Alex", Value = 1, Color = "#f8a398" } ,
                      new { Text = "Bob", Value = 2, Color = "#51a0ed" } ,
                      new { Text = "Charlie", Value = 3, Color = "#56ca85" }
                  });
          }).DataSource(d => d
              .WebApi()
              .Model(m =>
              {
                  m.Id(f => f.RecordId);
                  m.Field(f => f.Title).DefaultValue("No title");
                  m.Field(f => f.Title).DefaultValue("No title");
              })
              .Events(events => events.Error("error_handler"))
              .Read(read => read.Action("Get", "Meeting"))
              .Create(create => create.Action("Post", "Meeting"))
             .Update(update => update.Action("Put", "Meeting", new { id = "{0}" }))
             .Destroy(destroy => destroy.Action("Delete", "Meeting", new { id = "{0}" }))
              ).Deferred())
     
        @* All initialization scripts are rendered to the bottom of the page, see _Layout.cshtml *@
        @section scripts {
            @Html.Kendo().DeferredScripts()
        }
        <script>
    function error_handler(e) {
        var errors = $.parseJSON(e.xhr.responseText);
     
        if (errors) {
            alert("Errors:\n" + errors.join("\n"));
        }
    }
        </script>
 
meeting Web api controller
  
 
     [Route("api/[controller]")]
        public class MeetingController : Controller
        {
            private IMeetingData meetingData;
     
            public MeetingController(IMeetingData meetingData)
            {
                this.meetingData = meetingData;
            }
     
            // GET api/task
            [HttpGet]
            public DataSourceResult Get([DataSourceRequest]DataSourceRequest request)
            {
                return meetingData.GetAll().ToDataSourceResult(request);
            }
     
            // POST api/Meeting
            [HttpPost]
            public IActionResult Post(Meeting m)
            {
                if (!ModelState.IsValid)
                {
                    return BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(error => error.ErrorMessage));
                }
     
                meetingData.Insert(m, null);
     
                return new ObjectResult(new DataSourceResult { Data = new[] { m }, Total = 1 });
            }
     
            // PUT api/Meeting/5
            [HttpPut("{id}")]
            public IActionResult Put(int id, Meeting m)
            {
                if (ModelState.IsValid && id ==  m.RecordId)
                {
                    try
                    {
                        meetingData.Update(m, null);
                    }
                    catch (Exception)
                    {
                        return new NotFoundResult();
                    }
     
                    return new StatusCodeResult(200);
                }
                else
                {
                    return BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(error => error.ErrorMessage));
                }
            }
     
            // DELETE api/Meeting/5
            [HttpDelete("{id}")]
            public IActionResult Delete(int id)
            {
                try
                {
                    meetingData.Delete(new Meeting { RecordId = id }, null);
                }
                catch (Exception)
                {
                    return new NotFoundResult();
                }
     
                return new StatusCodeResult(200);
            }
        }
    }
Plamen
Telerik team
 answered on 16 May 2017
5 answers
399 views

Hello,

If I use my own Popup Edit Template in Kendo grid with i.e @(Html.EditorFor(m => m.Aktuell)) then I see a normal
Checkbox (see Picture1) - if I use @(Html.Kendo().CheckBoxFor(m => m.Aktuell)) I see the Kendo Checkbox (see picture2)

It seems that using Html.EditorFor in grid Popup Edit Template do not use the Editor templates in Views\Shared\EditorTemplates\?

robert

Angel Petrov
Telerik team
 answered on 12 May 2017
2 answers
143 views

I am trying to dynamically add change event to dropdownlist like

$("#ID").data("kendoDropDownList").bind("MyChangefunction", onChange);

but I get

Uncaught ReferenceError: onChange is not defined

what is onChange and where is defined?
Dina
Top achievements
Rank 1
 answered on 12 May 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?