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

I have the following grid configuration

@(Html.Kendo().Grid<CompanyLocationViewModel>()
      .Name("companyLocationGrid")
      .Columns(columns =>
      {
         columns.Bound(p => p.Code).Title("Grid Code");
         ...
      })
      .Editable(editable => editable.Mode(GridEditMode.PopUp))
      ...
)

The model does not have any Display attributes attached to it.

The grid look as expected with the header label "Grid Code" however the popup editor still is opened with the label "Code". Is this function as design or a bug? My requirement needs exactly this to have a different label on the grid and the popup. Can I use this to my advantage or this is going to be solved in a future release?

Viktor Tachev
Telerik team
 answered on 28 May 2018
4 answers
142 views

Hello,

I have a Dropdownlist and want find and select item from the list but the search value is not the DataValueField but another field in the dataitems Collection...

How to do this in the Right way?

robert

Robert Madrian
Top achievements
Rank 1
Veteran
Iron
 answered on 25 May 2018
1 answer
181 views

This doesn't work

 

  columns.Bound(p => p.Similarity).ClientHeaderTemplate("<a class='k-link myHeaderTemplate' href=''>Your Title <span class='glyphicon glyphicon - question - sign' data-toggle='tooltip' title='Sample tooltip'></span> </a>");

 

I don't see the tooltip at all.

 

How do I fix this ? 

Preslav
Telerik team
 answered on 25 May 2018
3 answers
1.4K+ views

I am Migrating the app from MVC 5 to Core 2.0. We are facing issue with the grid client template as we are unable to use it when we use it along with the editable property. Following is the code.

01.@(Html.Kendo().Grid<PPVR>()
02.                                                .Name("PPVRGird")
03.                                                .Columns(columns =>
04.                                                {
05.                                                    columns.Bound(e => e.id).Hidden();
06.                                                    columns.Bound(c => c.name);
07.                                                    columns.Bound(c => c.quantity);
08.                                                    columns.Bound(c => c.type);
09.                                                    columns.Bound("").ClientTemplate("<div style='text-align:center'><a href='javascript:void(0)' class='k-grid-edit custom-action-button'onclick='customGridEditClick(this)'><img src='/Content/edit.svg' width ='40' height='40'/><br/>Edit</a></div>").HeaderHtmlAttributes(new { @class = "custom-action-button" }).Title("Edit").Width(150);
10.                                                    columns.Bound("").ClientTemplate("<div style='text-align:center'><a href='javascript:void(0)' class='custom-action-button pull-center' onclick='deleteppvr(#=id#)'><img src='/Content/trashed.svg' width='40' height='40' /><br />Delete</a></div>").HeaderHtmlAttributes(new { @class = "custom-action-button" }).Width(200);
11.                                                })
12.                                                    .Pageable()
13.                                                    .HtmlAttributes(new { style = " text-align:left; font-family:lato; font-zize:16px; " })
14.                                                    .DataSource(dataSource => dataSource
15.                                                    .Ajax()
16.                                                    .PageSize(100)
17.                                                    .Read(read => read.Action("GetPPVR", "PPV"))
18.                                                    .Model(model =>
19.                                                    {
20.                                                        model.Id(u => u.id);
21.                                                        model.Field(u => u.type).Editable(false);
22.                                                    })
23.                                                    .Update(update => update.Action("UpdatePPVR", "PPV"))
24.                                                    )
25. 
26..Editable(editable => editable.Mode(GridEditMode.InLine))
27. 
28.                                            )
29. 
30.

This brings the empty page. When I comment the line .Editable(editable => editable.Mode(GridEditMode.InLine)) page appears. It works well in MVC 5 but not in core 2.0.

Kindly suggest how can I achieve this.

Preslav
Telerik team
 answered on 24 May 2018
2 answers
799 views

Hi all,

 

I hope I can explain this.  I will try to put together a small sample, but I wanted to get this out there as soon as I could.

I'm using ASP.Net Core 2.0.

 

I have a grid that has a foreign key to an enum value on my model.  I have an EditorTemplate set up, which builds a SelectList from the enum values and binds it to a Kendo DropDownList, and it works great:

@model MyEnumType
 
@{
    var enumTypeSelect = Enum.GetValues(typeof(MyEnumType))
                                 .Cast<MyEnumType>()
                                 .Select(value => new SelectListItem()
                                 {
                                     Text = value.ToString(),
                                     Value = ((int)value).ToString()
                                 });
}
@(Html.Kendo().DropDownListFor(model => model)
                .DataTextField("Text")
                .DataValueField("Value")
                .BindTo(enumTypeSelect))

 

And in my grid:

@(Html.Kendo().Grid<MyViewModel>(Model.Items)
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(li => li.ID).Visible(false);
                    columns.Bound(li => li.EnumType).Width(170)
                                                .ClientTemplate("#: Description #")
                                                .EditorTemplateName("_GetValidEnumItemTypesPartial");
                ... rest of grid...

 

Now, though, I have a requirement where once I select certain enum types, I have to exclude OTHER enum types from subsequent entries in my model.  This is similar to, but not exactly, like a set of cascading drop downs, where the contents of the second depend upon the first.

So, I need to filter those enum types from the list.  I've tried a couple things: 

 

- setting the drop down's dataSource filter, like this:

$("#LineItemType").data().kendoDropDownList.dataSource.filter({ field: 'Value', operator: 'neq', value: 1 })

or

$("#LineItemType").data().kendoDropDownList.dataSource.filter({ field: 'Text', operator: 'neq', value: 'MyValue' })

I've tried this at various places: when I've added the item to the grid, and when I'm about to add the item.  This doesn't seem to work at all.

- Loading the list of valid values via Ajax - the problem there is that I don't know whether I'm updating the FIRST value (so I can set it to anything) or a NEW value (where I would restrict), so I can't reliably determine what the values should be.

Nothing seems to work so far.

 

There's an option that changes my data model - but I would rather not do this if I can avoid it.

Any help is appreciated - thanks!

 

Phil

 

 

 

 

 

Stefan
Telerik team
 answered on 24 May 2018
2 answers
190 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
167 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
231 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
166 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
205 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
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?