We have a complicated Kendo Grid with Tag Helper notification. We need to use On Cancel Event within edit operation, by pressing Cancel button. Here is an example (but not Tag Helper)
@(Html.Kendo().Grid<MyModel>()I have an Editor on a page and there are several Content Security Policy violations in the console. Here is an example:
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src-attr 'unsafe-hashes' 'sha256-aqNNdDLnnrDOnTNdkJpYlAxKVJtLt9CtFLklmInuUAE='". Either the 'unsafe-inline' keyword, a hash ('sha256-5TmCSWsRHHKtNC4AgS23KS5Z9SBqma0xikI6H6iJ1/Y='), or a nonce ('nonce-...') is required to enable inline execution.
Is it possible to use an Editor without adding unsafe-inline to style-src-attr?
Thank you
Hello
We are currently working on improving the content security policy header of our application to remove the unsafe-inline and unsafe-eval for the script element.
I am facing some issues when using the Template element with the generated deferred javascript mostly in the grid and I hope someone could help me with that.
Firstly, I'd like to know if there are some tag helpers that could be used to generate some template. To be more explicit : we use some shared and partial views to render the components in edition mode in our grids. These views are written using tag helpers, for instance we have the following file Views\Shared\EditorTemplates\DateTime.cshtml :
@model DateTime
<kendo-datetimepicker asp-for="@Model" />
Used in our grids :
column.Bound(User => User.DateCreated).EditorTemplateName("DateTime")
(this is a basic example but we have some more complex views using home made components with taghelper syntax)
I noticed there is a kendo-template tag helper and I would like to know if there is any way to use it in our views, so I could replace my view with the following code and use the EditorTemplateComponentName extension method in my grid :
<kendo-template>
<kendo-datetimepicker asp-for="@Model" />
</kendo-template>
When I tried to do this I have an exception :
Secondly, I noticed an issue when using some kendo elements in editor templates: the javascript rendered in the deferred script file includes the initialisation scripts at the root of the script file. This mainly cause some issues in my pages when some other element has the same names (but I think it can lead to some other issues).
For instance, I have the following column definition in my grid:
<columns>
<column field="FullName" title="FullName"></column>
<column field="DateCreated" title="DateCreated">
<column-editor-template>
<kendo-datetimepicker name="dateCreated"></kendo-datetimepicker>
</column-editor-template>
</column>
</columns>
Then in the kendo-deferred-script javascript file I can see the dateCreated element is inialized at the beginning of the file and in the template function:
I'm joining a sample application with both cases to help reproduce the issues.
Is there something I'm doing wrong or any improvement coming in the next versions to fix these issues ?
Thanks in advance
Yael
public class TipoVia
{
public Guid Id {get; set;}
public string Codigo {get; set;}
public string Descripcion {get; set;}
}
public class DataContext : DbContext
{
public DbSet<TipoVia> TiposVia { get; set; }
}
@Html.Kendo().Grid<TipoVia>.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Codigo);
columns.Bound(p => p.Descripcion);
}
.DataSource(dataSource =>
dataSource.Ajax().PageSize(10)
.Read(read => read.Action("GetData", "ControllerTipoVia").Data("obtenerModel").Type(HttpVerbs.Post))
);
public virtual Task<IActionResult> ObtenerPaginaKendo([DataSourceRequest]DataSourceRequest request, TConsultaViewModel viewModelVista)
{
var dsResult = viewModelVista.DataContext.TiposVia.ToDataSourceResult(request);
return Task.Run<IActionResult>(() => Json(dsResult));
}
Closed
Good evening,
I've just upgraded my project from using Telerik UI ASP.NET Core 2022.1.301 to 2024.3.806.
I previously used this article to add icons to my menu items:
Add Font Icons to Menu Items - Kendo UI Menu - Kendo UI for jQuery (telerik.com)
After the upgrade, the icons are no longer appearing.
I'm using the following:
menu.Add().Encoded(false).Text("<span class=\"k-icon k-font-icon k-i-gears\"></span> Site Administration").Url("~/Admin")
menu.Add().Encoded(false).Text("<span class=\"k-icon k-font-icon k-i-user\"></span> " + User.Identity.Name)
I appreciate that the way the icons works has changed since 2023 R3, but most of the icons seem to work without me having to install anything extra (Font Icons in the Telerik and Kendo UI Design System | Design System Kit). For example, this works:
columns.Command(command => command.Custom("View").Click("openDetailsPage").IconClass("k-icon k-i-hyperlink-open")).Width(80);
Is this because the Telerik.FontIcons and Telerik.SvgIcons 3.0.0 packages are showing under my project dependencies?
Any clarification you can give would be much appreciated.
Kind regards,
Richard
Hello everyone, while trying to implement a grid with filtering and sorting, I came across an issue that seems to be recurring. In the database, I have columns (IdLotto and IdPratica) that are numeric.
From what I’ve read, filtering and sorting of numbers are not supported, only strings are. So I tried searching and implemented my own partial solution:
var avrs = _avrService.GetFiltered().Select(a =>
new GetAllAvr()
{
IdLotto = a.IdLotto.ToString(),
IdPratica = a.IdPratica.ToString()
});
var dsResult = avrs.ToDataSourceResult(request);
GetFiltered returns IQueryable of db's entity.
Partial because filtering works, but sorting doesn’t. Since string sorting is different from numeric sorting, the result is actually an incorrect order.
I wonder if I'm doing something wrong, if I need extra support from jQuery, or if I need to fully customize filtering and sorting in the controller method.
Thanks for the help