Telerik Forums
UI for ASP.NET Core Forum
2 answers
205 views
I want to open window like dialog. freezing the background page. Can I get it.
Vincent
Top achievements
Rank 1
Iron
 answered on 24 May 2018
1 answer
192 views

Hi,

 

When I use  a simple MVC Core Kendo Grid and deploy it to Azure it works fine, however when I make the grid editable I get the following exception (only on Azure)

Failed method Kendo.Mvc.UI.GridBoundColumn`2.GetEditor

Exception System.InvalidOperationException: Cannot find compilation library location for package 'Microsoft.Win32.Registry' at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List`1 assemblies) at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths() at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.<>c.<GetReferencePaths>b__8_0(CompilationLibrary library) at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext() at Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable`1 parts, MetadataReferenceFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.GetCompilationReferences() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.get_CompilationReferences() at Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature.get_References() at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors() at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath) at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage) at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TemplateRenderer.Render() at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TemplateBuilder.Build() at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.GenerateEditor(ModelExplorer modelExplorer, String htmlFieldName, String templateName, Object additionalViewData) at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.Editor(String expression, String templateName, String htmlFieldName, Object additionalViewData) at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperEditorExtensions.Editor(IHtmlHelper htmlHelper, String expression, String templateName, Object additionalViewData) at Kendo.Mvc.UI.GridBoundColumn`2.GetEditor(IHtmlHelper helper, HtmlEncoder encoder) at Kendo.Mvc.UI.Grid`1.<>c__DisplayClass66_1.<InitializeEditors>b__2(IGridBoundColumn column) at Kendo.Mvc.Extensions.EnumerableExtensions.Each[T](IEnumerable`1 instance, Action`1 action) at Kendo.Mvc.UI.Grid`1.InitializeEditors() at Kendo.Mvc.UI.Grid`1.ProcessSettings() at Kendo.Mvc.UI.WidgetBase.RenderHtml(TextWriter writer) at Kendo.Mvc.UI.WidgetBase.ToHtmlString() at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.WriteTo(TextWriter writer, HtmlEncoder encoder) at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewBuffer.<WriteToAsync>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderLayoutAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.<ExecuteAsync>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.<ExecuteAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewResult.<ExecuteResultAsync>d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeResultAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResultFilterAsync>d__24.MoveNext() --- End of stack trace from previous location where..........

 

Any help would be appreciated.

 

 

 

 

Konstantin Dikov
Telerik team
 answered on 23 May 2018
5 answers
318 views

I'm just starting to investigate ASP.NET Core 2.

I've just updated Visual Studio 2017 to get the latest version of Core, and installed UI for ASP.NET Core version 2017.3.1026.

However when I try to create a project using the Telerik ASP.NET Core MVC Application template, I'm unable to select a version of the framework for Core 2.1. The drop-down list is empty. The list shows version 2017.3.1026 for 1.1 and 1 projects.

Do I need another version to support 2.1? It is my understanding that the Q3 release supports Core 2?

I've attached a screenshot.

Shannon
Top achievements
Rank 1
 answered on 16 May 2018
1 answer
215 views
I have a fresh copy of VS 2017.  I downloaded the .NET Core UI package and attempted to run the examples to get a kick-start on development.  It apparently is looking for .NET 4.5.1 and .NET Core 1.0.  Are there any tricks to getting this working without installing the old libraries?    
Neli
Telerik team
 answered on 15 May 2018
1 answer
242 views

Is there a way of binding a Toolbar to data in the same way as the Treeview can be bound to data?

I have tried creating my toolbar list dynamically as follows.

List<ToolBarItem> toolbaritems = new List<ToolBarItem>();
ToolBarItem item = new ToolBarItem
{
    Text = "Button",
    Type = CommandType.Button
};
toolbaritems.Add(item);
ToolBarItemFactory factory = new ToolBarItemFactory(toolbaritems);
ViewData["DocumentToolbar"] = factory;

I have then tried to bind the data to the control as follows.

@(Html.Kendo().ToolBar()
    .Name("ToolBar")
    .Items((Action<ToolBarItemFactory>) ViewData["DocumentToolbar"]))

I am getting the following error.

InvalidCastException: Unable to cast object of type 'Kendo.Mvc.UI.Fluent.ToolBarItemFactory' to type 'System.Action`1[Kendo.Mvc.UI.Fluent.ToolBarItemFactory]'.

Is this possible? And if so, how?

Ianko
Telerik team
 answered on 15 May 2018
1 answer
288 views

I have a requirement to edit an object that has a list of texts associated with the object. The texts can not be edited again. I have found how to post a grid at this link https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/post-grid-with-form but the example uses incell editing.

So I decided to just change the incell to popup and extected it to work. At my surprise they were not. It seems popup requires the server editing. Is this true or are there posibilities to have the popup editing also on the client?

Tsvetina
Telerik team
 answered on 14 May 2018
1 answer
213 views

I want to use the telerik DropDownList to display a list of objects. I saw that the DropDownList support also an optional label but it seems it does not work.

Here is the code

@model IEnumerable<ActionViewModel>
 
@(Html.Kendo().DropDownList()
          .Name("actionDropDownList")
          .DataTextField("Display")
          .DataValueField("Id")
          .BindTo(Model)
          .OptionLabel(Localizer.GetString("Select an action..."))
          .Deferred()
 )

The generated script contains ""optionLabel":{"Name":"Select an action...","Value":"Select an action...","ResourceNotFound":true,"SearchedLocation":null}"

What do I have to give to the OptionalLabel so that it generates the optionalLabel with the properties of DataValueField and DataTextField?

 

 

Dan
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 14 May 2018
7 answers
1.3K+ views

Hi,

I have a strange issue using the HtmlHelper generating a Checkbox using @Html.Kendo().CheckBoxFor(m => m.enabled) and submitting the form to my controller.
The issue happens after submitting the form when some server validation errors occur.
The form is properly rendered again, but when i re-submit the form, i get an error when the model is deserialized. (The value 'on, false' is not valid for Enabled).
Looking at the serialized form data i can see enabled actually have the value "on,false" instead of just "false".
Any ideas ?
Thanks in advance.

Joana
Telerik team
 answered on 14 May 2018
1 answer
189 views

Hi all,

 

So I've seen a couple of questions about this, but none of the solutions have helped. 

I'm attempting to build something like this demo for Asp.Net Core 2.0:  https://demos.telerik.com/aspnet-core/grid/checkbox-selection

 

When I set up the app, I don't get the checkboxes in the grid.  I've tried multiple browsers.

 

I'm using version 2017.3.1206.  I built a test project to try to get this to work, building off the code in the above demo.

 

Here is my view:

@(Html.Kendo().Grid<TestKendo.Controllers.ProductViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Select().Width(50);
                    columns.Bound(p => p.ProductName);
                    columns.Bound(p => p.UnitPrice).Width(100);
                    columns.Bound(p => p.UnitsInStock).Width(100);
                    columns.Bound(p => p.Discontinued).Width(100);
                })
                .Pageable()
                .PersistSelection()
                .Sortable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model(model => model.Id(p => p.ProductID))
                    .Read(read => read.Action("Selection_Read", "Home"))
                )
)
 
@section scripts {
    @Html.Kendo().DeferredScripts()
}

 

 

Here is my controller:

 

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Microsoft.AspNetCore.Mvc;
using TestKendo.Models;
 
namespace TestKendo.Controllers
{
    public class ProductViewModel
    {
        public int ProductID { get; set; }
        public string ProductName { get; set; }
        public decimal UnitPrice { get; set; }
        public int UnitsInStock { get; set; }
        public bool Discontinued { get; set; }
    }
 
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
 
        public ActionResult Selection_Read([DataSourceRequest] DataSourceRequest request)
        {
            var products = new List<ProductViewModel>
            {
                new ProductViewModel { ProductID = 1, ProductName = "Prod1", UnitPrice = 1.25M, UnitsInStock = 10 },
                new ProductViewModel { ProductID = 2, ProductName = "Prod2", UnitPrice = 2.50M, UnitsInStock = 20 },
            };
            return Json(products.ToDataSourceResult(request));
        }
         
 
        public IActionResult About()
        {
            ViewData["Message"] = "Your application description page.";
 
            return View();
        }
 
        public IActionResult Contact()
        {
            ViewData["Message"] = "Your contact page.";
 
            return View();
        }
 
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}

 

Here's my _Layout.cshtml:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - TestKendo</title>
 
    <environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
        <link rel="stylesheet" href="~/lib/kendo/css/web/kendo.common-nova.min.css" />
        <link rel="stylesheet" href="~/lib/kendo/css/web/kendo.nova.min.css" />
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
        <script src="~/js/site.js" asp-append-version="true"></script>
        <script src="~/lib/kendo/js/kendo.all.min.js"></script>
        <script src="~/lib/kendo/js/kendo.aspnetmvc.min.js"></script>
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery"
                crossorigin="anonymous"
                integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
        </script>
                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="~/js/site.min.js" asp-append-version="true"></script>
    </environment>
</head>
<body>
    <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">TestKendo</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
                    <li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
                    <li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>© 2018 - TestKendo</p>
        </footer>
    </div>
 
    @RenderSection("Scripts", required: false)
</body>
</html>

 

The grid renders fine, but the selection columns are empty.  Any help is appreciated - thanks!

Phil
Top achievements
Rank 1
 answered on 11 May 2018
1 answer
641 views
I want to persist grid state whenever a column width, order, or visibility state is changed such that when a user visits the same page in the future the columns are in the same state.  I don't want to require an extra button click after the user makes a change to column state.
Viktor Tachev
Telerik team
 answered on 11 May 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?